Skip to content

Instantly share code, notes, and snippets.

@mperham
Created January 14, 2016 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mperham/4b209912d9b0c4acb515 to your computer and use it in GitHub Desktop.
Save mperham/4b209912d9b0c4acb515 to your computer and use it in GitHub Desktop.
class MyCode
def process
do_something if leader?
end
def leader?
Sidekiq::Senate.leader?
end
end
def test_something
code = MyCode.new
# stub with minitest
code.stub(:leader?, true) do
code.process
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment