Created
May 18, 2012 21:18
-
-
Save yarinb/2727648 to your computer and use it in GitHub Desktop.
Rspec stubs are bad practice
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
require 'rspec/mocks/standalone' | |
class Service | |
def self.access_thirdparty_action | |
puts "communicating with the world!" | |
end | |
end | |
class ServiceManager | |
def work | |
puts "before work" | |
Service.access_thirdparty_action | |
puts "after work" | |
end | |
end | |
describe Service do | |
it "works" do | |
Service.stub!(:access_thirdparty_action) | |
ServiceManager.new.work | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment