File: call_original.feature

package info (click to toggle)
ruby-rspec-mocks 2.14.5-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 868 kB
  • ctags: 725
  • sloc: ruby: 8,227; makefile: 4
file content (24 lines) | stat: -rw-r--r-- 679 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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