Sha256: 084c6d0f06838abed24b2598a7c39bb8267b9c54bb7cfb0115f4d82da512f98d
Contents?: true
Size: 1.07 KB
Versions: 4
Compression:
Stored size: 1.07 KB
Contents
require 'spec_helper' module Rspec module Mocks describe "calling :should_receive with an options hash" do it "should report the file and line submitted with :expected_from" do begin mock = Rspec::Mocks::Mock.new("a mock") mock.should_receive(:message, :expected_from => "/path/to/blah.ext:37") mock.rspec_verify rescue Exception => e ensure e.backtrace.to_s.should =~ /\/path\/to\/blah.ext:37/m end end it "should use the message supplied with :message" do lambda { m = Rspec::Mocks::Mock.new("a mock") m.should_receive(:message, :message => "recebi nada") m.rspec_verify }.should raise_error("recebi nada") end it "should use the message supplied with :message after a similar stub" do lambda { m = Rspec::Mocks::Mock.new("a mock") m.stub(:message) m.should_receive(:message, :message => "from mock") m.rspec_verify }.should raise_error("from mock") end end end end
Version data entries
4 entries across 4 versions & 1 rubygems