Last active
July 18, 2017 17:35
-
-
Save agraves/875b5efd765401b731b312d7e6cde758 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
# implicit | |
class ErrorReporter | |
def active? | |
Rails.environment.production? | |
end | |
end | |
Rails.environment.stub :production?, true do | |
assert ErrorReporter.active? | |
end | |
# explicit | |
class ErrorReporter | |
def active?(environment=Rails.environment) | |
environment.production? | |
end | |
end | |
assert ErrorReporter.active? OpenStruct.new(:production => true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment