Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. context "making sure we don't accidentally take the site down" do
  2. EXPECTED_NUMBER_OF_WORKERS = 10 # copy this value from the other place it's defined; this shouldn't be dynamic, repeating yourself is better
  3.  
  4. it "reminds the user of side effects" do
  5. begin
  6. expect(MySystem::NUMBER_OF_WORKERS).to eq(EXPECTED_NUMBER_OF_WORKERS)
  7. rescue RSpec::Expectations::ExpectationNotMetError => error
  8. error.message << "\n"
  9. error.message << <<~HEREDOC
  10. 📎 Oh hi there! It looks like you changed the value of MySystem::NUMBER_OF_WORKERS.
  11.  
  12. This constant is used to determine how many workers should process a job from the queue
  13. at any given time, so changing it has some very meaningful side effects.
  14.  
  15. If this is what you intended - great! Update this test with the new value and you're good to go.
  16.  
  17. If it's not what you intended - please set the value back to #{EXPECTED_NUMBER_OF_WORKERS}.
  18. HEREDOC
  19.  
  20. raise error
  21. end
  22. end
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement