/example_stub_problem.rb Secret
Last active
December 8, 2015 19:55
-
-
Save Papierkorb/e56273f0da711687f72e to your computer and use it in GitHub Desktop.
Having some trouble testing module instance method behavior.
This file contains 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
module Foo | |
def bar | |
"#{to_s} whizbang" | |
end | |
end | |
describe Foo do | |
let(:klass) do | |
Class.new do | |
include Foo | |
end | |
end | |
subject{ klass.new } | |
context "#bar" do | |
it "works" do | |
expect(subject).to receive(:to_s).and_return "test" | |
expect(subject.bar).to eq "test whizbang" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment