spec/spec/mocks/partial_mock_spec.rb in rspec-1.1.8 vs spec/spec/mocks/partial_mock_spec.rb in rspec-1.1.9
- old
+ new
@@ -9,25 +9,31 @@
it "should name the class in the failure message" do
@object.should_receive(:foo)
lambda do
@object.rspec_verify
- end.should raise_error(Spec::Mocks::MockExpectationError, /Object/)
+ end.should raise_error(Spec::Mocks::MockExpectationError, /<Object:.*> expected/)
end
+ it "should name the class in the failure message when expectation is on class" do
+ Object.should_receive(:foo)
+ lambda do
+ Object.rspec_verify
+ end.should raise_error(Spec::Mocks::MockExpectationError, /<Object \(class\)>/)
+ end
+
it "should not conflict with @options in the object" do
@object.instance_eval { @options = Object.new }
@object.should_receive(:blah)
@object.blah
end
it "should_not_receive should mock out the method" do
- pending("example raises the expected error, yet fails")
@object.should_not_receive(:fuhbar)
lambda do
@object.fuhbar
- end.should raise_error(MockExpectationError, "Mock 'Object' expected :fuhbar with (no args) 0 times, but received it once")
+ end.should raise_error(MockExpectationError, /<Object:.*> expected :fuhbar with \(no args\) 0 times/)
end
it "should_not_receive should return a negative message expectation" do
@object.should_not_receive(:foobar).should be_kind_of(NegativeMessageExpectation)
end
@@ -64,11 +70,10 @@
@object.should_receive('foobar')
@object.foobar
end
it "should_not_receive should also take a String argument" do
- pending("example raises the expected error, yet fails")
@object.should_not_receive('foobar')
lambda do
@object.foobar
end.should raise_error(Spec::Mocks::MockExpectationError)
end
@@ -77,10 +82,10 @@
allow_message_expectations_on_nil
@this_will_resolve_to_nil.should_receive(:foobar)
lambda do
@this_will_resolve_to_nil.rspec_verify
- end.should raise_error(Spec::Mocks::MockExpectationError, /NilClass.*expected :foobar with/)
+ end.should raise_error(Spec::Mocks::MockExpectationError, /nil expected :foobar with/)
end
end
describe "Partially mocking an object that defines ==, after another mock has been defined" do
before(:each) do