Sha256: 79ad8cbf98b9072677ca6e59026cecd394ee7caacf4200e77d8a2c4b8e19ac7f

Contents?: true

Size: 973 Bytes

Versions: 2

Compression:

Stored size: 973 Bytes

Contents

Feature: standalone

  require "rspec/mocks/standalone" to expose the mock framework
  outside the RSpec environment. This is especially useful for
  exploring rspec-mocks in irb.

  Scenario: stub outside rspec
    Given a file named "example.rb" with:
      """
      require "rspec/mocks/standalone"

      greeter = double("greeter")
      greeter.stub(:say_hi) { "Hello!" }
      puts greeter.say_hi
      """
    When I run "ruby example.rb"
    Then the output should contain "Hello!"

  Scenario: message expectation outside rspec
    Given a file named "example.rb" with:
      """
      require "rspec/mocks/standalone"

      greeter = double("greeter")
      greeter.should_receive(:say_hi)

      RSpec::Mocks.verify
      """
    When I run "ruby example.rb"
    Then the output should contain "say_hi(any args) (RSpec::Mocks::MockExpectationError)"
    Then the output should contain "expected: 1 time"
    Then the output should contain "received: 0 times"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-mocks-2.3.0 features/outside_rspec/standalone.feature
rspec-mocks-2.2.0 features/outside_rspec/standalone.feature