File: spy_unstubbed_method.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 (18 lines) | stat: -rw-r--r-- 603 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Feature: Spy on an unstubbed method

  Using have_received on an unstubbed method will never pass, so rspec-mocks
  issues a helpful error message.

  Scenario: fail to verify a stubbed method
    Given a file named "failed_spy_spec.rb" with:
      """ruby
      describe "have_received" do
        it "raises a helpful error for unstubbed methods" do
          object = Object.new
          object.object_id
          object.should have_received(:object_id)
        end
      end
      """
    When I run `rspec failed_spy_spec.rb`
    Then the output should contain "that method has not been stubbed"