Skip to content

Instantly share code, notes, and snippets.

@jimweirich
Created June 20, 2012 18:18
Show Gist options
  • Save jimweirich/2961375 to your computer and use it in GitHub Desktop.
Save jimweirich/2961375 to your computer and use it in GitHub Desktop.
Isolating Class Changes
context "with an isolated decorator class" do
let(:decorator_class) { Class.new(Decorator) }
subject{ decorator_class.new(source) }
context "when #hello_world is called again" do
it "proxies method directly after first hit" do
subject.methods.should_not include(:hello_world)
subject.hello_world
subject.methods.should include(:hello_world)
end
end
context "when #hello_world is called for the first time" do
it "hits method missing" do
subject.should_receive(:method_missing)
subject.hello_world
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment