Created
December 8, 2015 19:46
-
-
Save hxegon/8339dd224a825ec0ba59 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 | |
describe "#bar" do | |
it "works" do | |
base = Class.new { include Foo } | |
# This allow fails saying base doesn't implement :read | |
allow(base).to receive(:to_s) { "test" } | |
expect(base.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