Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- context "making sure we don't accidentally take the site down" do
- EXPECTED_NUMBER_OF_WORKERS = 10 # copy this value from the other place it's defined; this shouldn't be dynamic, repeating yourself is better
- it "reminds the user of side effects" do
- begin
- expect(MySystem::NUMBER_OF_WORKERS).to eq(EXPECTED_NUMBER_OF_WORKERS)
- rescue RSpec::Expectations::ExpectationNotMetError => error
- error.message << "\n"
- error.message << <<~HEREDOC
- 📎 Oh hi there! It looks like you changed the value of MySystem::NUMBER_OF_WORKERS.
- This constant is used to determine how many workers should process a job from the queue
- at any given time, so changing it has some very meaningful side effects.
- If this is what you intended - great! Update this test with the new value and you're good to go.
- If it's not what you intended - please set the value back to #{EXPECTED_NUMBER_OF_WORKERS}.
- HEREDOC
- raise error
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement