Sha256: 08d289dfda5b1c5ae1d4b2ca7aef301310d37b1c280b20e1f900705643cb0512
Contents?: true
Size: 1.21 KB
Versions: 5
Compression:
Stored size: 1.21 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper' require 'mspec/guards/conflict' describe Object, "#conflicts_with" do before :each do ScratchPad.clear end it "does not yield if Object.constants includes any of the arguments" do Object.stub!(:constants).and_return(["SomeClass", "OtherClass"]) conflicts_with(:SomeClass, :AClass, :BClass) { ScratchPad.record :yield } ScratchPad.recorded.should_not == :yield end it "yields if Object.constants does not include any of the arguments" do Object.stub!(:constants).and_return(["SomeClass", "OtherClass"]) conflicts_with(:AClass, :BClass) { ScratchPad.record :yield } ScratchPad.recorded.should == :yield end end describe Object, "#conflicts_with" do before :each do @guard = ConflictsGuard.new ConflictsGuard.stub!(:new).and_return(@guard) end it "sets the name of the guard to :conflicts_with" do conflicts_with(:AClass, :BClass) { } @guard.name.should == :conflicts_with end it "calls #unregister even when an exception is raised in the guard block" do @guard.should_receive(:unregister) lambda do conflicts_with(:AClass, :BClass) { raise Exception } end.should raise_error(Exception) end end
Version data entries
5 entries across 5 versions & 1 rubygems