Sha256: a73c70aa6b5e9d475338c8262da41145122473d4f27082e49695a6d459d9ad47

Contents?: true

Size: 1020 Bytes

Versions: 51

Compression:

Stored size: 1020 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: method stub outside rspec
    Given a file named "example.rb" with:
      """ruby
      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:
      """ruby
      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 "RSpec::Mocks::MockExpectationError"
    And the output should contain "say_hi(any args)"
    And the output should contain "expected: 1 time"
    And the output should contain "received: 0 times"

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/outside_rspec/standalone.feature
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/rspec-mocks-2.14.6/features/outside_rspec/standalone.feature
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/rspec-mocks-2.14.6/features/outside_rspec/standalone.feature
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/outside_rspec/standalone.feature
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/outside_rspec/standalone.feature
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/outside_rspec/standalone.feature
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/outside_rspec/standalone.feature
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/outside_rspec/standalone.feature
rspec-mocks-2.99.4 features/outside_rspec/standalone.feature
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rspec-mocks-2.14.6/features/outside_rspec/standalone.feature
rspec-mocks-2.99.3 features/outside_rspec/standalone.feature
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rspec-mocks-2.13.0/features/outside_rspec/standalone.feature
rspec-mocks-2.99.2 features/outside_rspec/standalone.feature
dxruby_rp5-0.0.4 spec/vendor/rspec-mocks-2.14.4/features/outside_rspec/standalone.feature
rspec-mocks-2.99.1 features/outside_rspec/standalone.feature
rspec-mocks-2.99.0 features/outside_rspec/standalone.feature
rspec-mocks-2.99.0.rc1 features/outside_rspec/standalone.feature
rspec-mocks-2.14.6 features/outside_rspec/standalone.feature
rspec-mocks-2.99.0.beta2 features/outside_rspec/standalone.feature
rspec-mocks-2.14.5 features/outside_rspec/standalone.feature