Easiest way to get basic integration coverage in rails?
I'm taking over an application. It has no testing.
I'm looking for the bare minimum integration testing I can start with to have at least something to yell at me if I break something.
I was thinking:
- Load small sql d开发者_JS百科ump
- Given a list of URL
- Request URL and ensure a successful response
Searching for something like this has been fruitless.
Any pointers to something like this?
Or, how would you implement something like this quick 'n dirty to get beginning coverage?
I used basic rspec integration testing:
# login factories, etc
context "Login" do
it "works" do
visit '/'
page.should have_content "Login: "
fill_in 'login', :with => @user.login
click_button 'Login'
page.should have_content @user.name
end
end
By creating the integration test, it forced me to make the necessary factories, so I could get an idea of the coupling for each page. Bonus: it made it easier to split the models up later when I added unit testing.
精彩评论