Sha256: 97955ba07eb167c6d6cd57f662705c7db5a1f7076cc2c25577cb3464577051dc

Contents?: true

Size: 762 Bytes

Versions: 38

Compression:

Stored size: 762 Bytes

Contents

Feature: expect a message on any instance of a class

  Use `any_instance.should_receive` to set an expectation that one (and only
  one) instance of a class receives a message before the example is completed.

  The spec will fail if no instance receives a message.

  Scenario: expect a message on any instance of a class
    Given a file named "example_spec.rb" with:
      """ruby
      describe "any_instance.should_receive" do
        it "verifies that one instance of the class receives the message" do
          Object.any_instance.should_receive(:foo).and_return(:return_value)

          o = Object.new
          o.foo.should eq(:return_value)
        end
      end
      """
    When I run `rspec example_spec.rb`
    Then the examples should all pass

Version data entries

38 entries across 38 versions & 8 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rspec-mocks-2.14.6/features/message_expectations/any_instance.feature
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/rspec-mocks-2.14.6/features/message_expectations/any_instance.feature
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/rspec-mocks-2.14.6/features/message_expectations/any_instance.feature
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/message_expectations/any_instance.feature
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/message_expectations/any_instance.feature
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/message_expectations/any_instance.feature
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/message_expectations/any_instance.feature
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/message_expectations/any_instance.feature
rspec-mocks-2.99.4 features/message_expectations/any_instance.feature
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rspec-mocks-2.14.6/features/message_expectations/any_instance.feature
rspec-mocks-2.99.3 features/message_expectations/any_instance.feature
rspec-mocks-2.99.2 features/message_expectations/any_instance.feature
dxruby_rp5-0.0.4 spec/vendor/rspec-mocks-2.14.4/features/message_expectations/any_instance.feature
rspec-mocks-2.99.1 features/message_expectations/any_instance.feature
rspec-mocks-2.99.0 features/message_expectations/any_instance.feature
rspec-mocks-2.99.0.rc1 features/message_expectations/any_instance.feature
rspec-mocks-2.14.6 features/message_expectations/any_instance.feature
rspec-mocks-2.99.0.beta2 features/message_expectations/any_instance.feature
rspec-mocks-2.14.5 features/message_expectations/any_instance.feature
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/rspec-mocks-2.14.4/features/message_expectations/any_instance.feature