Sha256: ee82dfb5fdab9b08905f299af9a28a3755ee4af6627d55ec9f7e51c281b9da07

Contents?: true

Size: 679 Bytes

Versions: 51

Compression:

Stored size: 679 Bytes

Contents

Feature: Calling the original method

  You can use `and_call_original` on the fluent interface
  to "pass through" the received message to the original method.

  Scenario: expect a message
    Given a file named "call_original_spec.rb" with:
      """ruby
      class Addition
        def self.two_plus_two
          4
        end
      end

      describe "and_call_original" do
        it "delegates the message to the original implementation" do
          Addition.should_receive(:two_plus_two).and_call_original
          Addition.two_plus_two.should eq(4)
        end
      end
      """
    When I run `rspec call_original_spec.rb`
    Then the examples should all pass

Version data entries

51 entries across 51 versions & 13 rubygems

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