Created
July 8, 2019 18:53
-
-
Save girasquid/937d8d0e9b13875307865775bc0324d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment