Sha256: fae2a39d0c0f0d8dcbf289127367d64c45cb8491359abd8440a298885000415b
Contents?: true
Size: 1.58 KB
Versions: 4
Compression:
Stored size: 1.58 KB
Contents
require File.dirname(__FILE__) + '/../../spec_helper.rb' module Spec module Mocks describe "calling :should_receive with an options hash" do include SandboxedOptions attr_reader :reporter, :example_group before do @reporter = ::Spec::Runner::Reporter.new(options) @example_group = Class.new(::Spec::Example::ExampleGroup) do plugin_mock_framework describe("Some Examples") end reporter.add_example_group example_group end it "should report the file and line submitted with :expected_from" do example_definition = example_group.it "spec" do mock = Spec::Mocks::Mock.new("a mock") mock.should_receive(:message, :expected_from => "/path/to/blah.ext:37") mock.rspec_verify end example = example_group.new(example_definition) reporter.should_receive(:example_finished) do |spec, error| error.backtrace.detect {|line| line =~ /\/path\/to\/blah.ext:37/}.should_not be_nil end example.execute(options, {}) end it "should use the message supplied with :message" do example_definition = @example_group.it "spec" do mock = Spec::Mocks::Mock.new("a mock") mock.should_receive(:message, :message => "recebi nada") mock.rspec_verify end example = @example_group.new(example_definition) @reporter.should_receive(:example_finished) do |spec, error| error.message.should == "recebi nada" end example.execute(@options, {}) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems