Sha256: 4daf2970e5d761defe4dd120762dacedc5106d216d1dff3757d916fb5d6db2be

Contents?: true

Size: 1.03 KB

Versions: 32

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

module RSpec
  module Mocks
    describe "calling :should_receive with an options hash" do
      it "reports 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")
          verify mock
        rescue Exception => e
        ensure
          expect(e.backtrace.to_s).to match(/\/path\/to\/blah.ext:37/m)
        end
      end

      it "uses the message supplied with :message" do
        expect {
          m = RSpec::Mocks::Mock.new("a mock")
          m.should_receive(:message, :message => "recebi nada")
          verify m
        }.to raise_error("recebi nada")
      end

      it "uses the message supplied with :message after a similar stub" do
        expect {
          m = RSpec::Mocks::Mock.new("a mock")
          m.stub(:message)
          m.should_receive(:message, :message => "from mock")
          verify m
        }.to raise_error("from mock")
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 8 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rspec-mocks-2.14.6/spec/rspec/mocks/options_hash_spec.rb
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/rspec-mocks-2.14.6/spec/rspec/mocks/options_hash_spec.rb
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/rspec-mocks-2.14.6/spec/rspec/mocks/options_hash_spec.rb
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/spec/rspec/mocks/options_hash_spec.rb
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/spec/rspec/mocks/options_hash_spec.rb
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/spec/rspec/mocks/options_hash_spec.rb
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/spec/rspec/mocks/options_hash_spec.rb
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/spec/rspec/mocks/options_hash_spec.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rspec-mocks-2.14.6/spec/rspec/mocks/options_hash_spec.rb
dxruby_rp5-0.0.4 spec/vendor/rspec-mocks-2.14.4/spec/rspec/mocks/options_hash_spec.rb
rspec-mocks-2.14.6 spec/rspec/mocks/options_hash_spec.rb
rspec-mocks-2.14.5 spec/rspec/mocks/options_hash_spec.rb
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/rspec-mocks-2.14.4/spec/rspec/mocks/options_hash_spec.rb
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/rspec-mocks-2.14.4/spec/rspec/mocks/options_hash_spec.rb
dxruby_rp5-0.0.3 spec/vendor/rspec-mocks-2.14.4/spec/rspec/mocks/options_hash_spec.rb
tuktuk-rails-0.0.10 vendor/bundle/ruby/2.0.0/gems/rspec-mocks-2.14.4/spec/rspec/mocks/options_hash_spec.rb
tuktuk-rails-0.0.9 vendor/bundle/ruby/2.0.0/gems/rspec-mocks-2.14.4/spec/rspec/mocks/options_hash_spec.rb
tuktuk-rails-0.0.8 vendor/bundle/ruby/2.0.0/gems/rspec-mocks-2.14.4/spec/rspec/mocks/options_hash_spec.rb
tuktuk-rails-0.0.7 vendor/bundle/ruby/2.0.0/gems/rspec-mocks-2.14.4/spec/rspec/mocks/options_hash_spec.rb
dxruby_rp5-0.0.2 spec/vendor/rspec-mocks-2.14.4/spec/rspec/mocks/options_hash_spec.rb