DRY your tests
If you group your tests in positive and negative responses, or in other types of groups, you can avoid repeating a simple part of your tests
context :valid do
after(:each) { expect(response).to be_success }
end
context :invalid do
after(:each) { expect(response).to_not be_success }
end
Then in your tests you can focus on testing what really changes.
Written by João Veiga
Related protips
1 Response
And all the initialisations and declarations with the before(:each) block.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#