Skip to content

Instantly share code, notes, and snippets.

@arwagner
Created November 15, 2011 02:05
Show Gist options
  • Save arwagner/1365904 to your computer and use it in GitHub Desktop.
Save arwagner/1365904 to your computer and use it in GitHub Desktop.
class Application
def fact s
end
end
module RFact
def fact fact_as_string
Application.new.fact fact_as_string
end
end
describe RFact do
let(:application) { stub }
describe "#fact" do
it "should call fact on a new Application object" do
include RFact
Application.should_receive(:new).and_return application
application.should_receive(:fact).with("x")
fact "x"
end
it "calling it twice should use the same application object" do
include RFact
Application.should_receive(:new).once
#fact "x"
#fact "y"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment