rails-4-1-rspec-3-0 icon indicating copy to clipboard operation
rails-4-1-rspec-3-0 copied to clipboard

Ch 8. Feature spec works without find method

Open JunichiIto opened this issue 10 years ago • 0 comments

users_spec uses find method:

    expect{
      click_link 'Users'
      click_link 'New User'
      fill_in 'Email', with: '[email protected]'
      find('#password').fill_in 'Password', with: 'secret123'
      find('#password_confirmation').fill_in 'Password confirmation',
        with: 'secret123'
      click_button 'Create User'
    }.to change(User, :count).by(1)

However it works without it:

    expect{
      click_link 'Users'
      click_link 'New User'
      fill_in 'Email', with: '[email protected]'
      fill_in 'Password', with: 'secret123'
      fill_in 'Password confirmation', with: 'secret123'
      click_button 'Create User'
    }.to change(User, :count).by(1)

Please consider another example for the usage of find. (Sorry, I have no idea now.)

JunichiIto avatar May 03 '15 12:05 JunichiIto