RSpec
ãããã¯ãã®æ½çã§ãããã©ã¼ã ã react component ã«ç½®ãæããæãå ã ãã£ã feature spec 㧠fill_in ãã¦ããé¨åã Capybara::ElementNotFound: ã§è½ã¡ãããã«ãªã£ã¦ãã¾ãã¾ããã fill_in 㯠id ã name ãç¡ãã¨é¸æã§ããªãï¼ æ°ãããã React â¦
- é表示ã«ãªã£ã¦ããè¦ç´ ã«ã¯ `visible: false` ãªãã·ã§ã³ã使ã - é表示ã«ãªã£ã¦ããè¦ç´ ã®å 容ããã¹ãããã«ã¯ `find(selector, visible: false).text(:all)` ã使ã
RSpecã® feature spec 㧠href ã®ç¡ã a ã¿ã°ã®ãã¹ãããããã¨ãã¦ããã£ãã®ã§ã¡ã¢ ãã¿ã³ / ãªã³ã¯ã®åå¨ ãã¿ã³ button ã submit <button>ãã¿ã³ã®ã©ãã«</button> <input type="submit" value="ãã¿ã³ã®ã©ãã«" /> expect(page).to have_button 'ãã¿ã³ã®ã©ãã«' ãªã³ã¯ a ã¿ã°ã¯ãã¿ã³ã§ã¯ãªããªã³ã¯ã§ãªãã¨ããããâ¦
ããã¸ã§ã¯ãã® RSpec ãã¿ã¦ãã¦ã include_context ã ã¨ããæç« ãããå ±éå¦çããã¦ããã£ã½ããã©ãã©ããããã®ãªã®ãç¥ããªãã£ãã®ã§èª¿ã¹ãã¡ã¢ include_context ref. shared context - Example groups - RSpec Core - RSpec - Relish shared_conteâ¦
Capybara 㧠visit ãã¦ã¢ã¯ã»ã¹ãã¦ããã¼ã¸ã®æ å ±ããã§ãã¯ããã current_host ã使ã current_url â String Fully qualified URL of the current page. ref. Class: Capybara::Session â Documentation for jnicklas/capybara (master) ä»ã«ãè²ã ããâ¦
ã¡ã½ãããããäºããã¹ã let(:foo) { create :foo } it 'foo has #method' do expect(foo).to respond_to(:method) end å㯠expect(foo.respond_to?(:method)).to be true ã¡ã½ããããªãäºããã¹ã let(:foo) { create :foo } it 'foo has #method' do eâ¦
ãã£ã¯ãã¼ï¼RubyãRailsãã»ã¼åå¿è ãã³å³å®æ¦ã§åè¦å «è¦ãã¦ãæ¥ã ã§ãã ActiveDecorator ã使ããã¦ãã Rails ã®ããã¸ã§ã¯ã㧠decorator ã®ãã¹ãã RSpec ã§æ¸ãã¦ããæãdecorator ã«ããã¯ãã®ã¡ã½ããã undefined method ã«ãªããã¹ããã³ã±ã¦â¦