I'm new to the world of rails and test driven development. For TDD, I'm using RSpec and Capybara. Currently, I'm working on a tutorial to learn more about Rails and the author is using following syntaxes:
page.should have_title('All users')
expect(page).to have_selector('li', text: user.name)
Since it seems that both are interchangeable I'm wondering when to use which syntax? Because, for the described case above, I could also write:
page.should have_title('All users')
page.should have_selector('li', text: user.name)
Which basically does the same, right?
Also, when should I use "specify" instead of "it"?
it { should have_link('Sign out', href: signout_path) }
specify { expect(user.reload.name).to eq new_name }
In this case, I could also write:
it { should have_link('Sign out', href: signout_path) }
it { expect(user.reload.name).to eq new_name }
I guess the decision of which one to use is based on what I want to express. Maybe, you can help me out here?!
Thanks!