Last Updated: February 25, 2016
·
545
· jveiga

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.

1 Response
Add your response

And all the initialisations and declarations with the before(:each) block.

over 1 year ago ·