Sha256: 3226d55b329efc75309808f8bbbd8cf21224859e8de8245f64546f877a194631

Contents?: true

Size: 1.59 KB

Versions: 38

Compression:

Stored size: 1.59 KB

Contents

Feature: configure any test framework to use rspec-mocks

  Test frameworks that want to use rspec-mocks can use
  RSpec::Mocks::setup(self) to hook into rspec-mocks. Doing so adds the
  following:

    To the object passed to setup:

      double # creates a test double
      mock   # creates a test double
      stub   # creates a test double

    To every object in the system:

      should_receive
      should_not_receive
      stub

  NOTICE: the stub() method that is added to the object passed to setup is not
  the same stub() method that is added to every other object.

  Scenario: RSpec::Mocks::setup(object) adds double, mock, and stub methods to the submitted object
    Given a file named "foo.rb" with:
      """ruby
      require 'rspec/mocks'

      class CodeExample
        def init
          RSpec::Mocks::setup(self)
        end
      end

      example = CodeExample.new
      example.init

      puts example.respond_to?(:double)
      puts example.respond_to?(:mock)
      puts example.respond_to?(:stub)
      """

    When I run `ruby foo.rb`
    Then the output should contain "true"
    But  the output should not contain "false"

  Scenario: RSpec::Mocks::setup(anything) adds methods to Object
    Given a file named "foo.rb" with:
      """ruby
      require 'rspec/mocks'

      RSpec::Mocks::setup(Object.new)

      obj = Object.new

      puts obj.respond_to?(:should_receive)
      puts obj.respond_to?(:should_not_receive)
      puts obj.respond_to?(:stub)
      """

    When I run `ruby foo.rb`
    Then the output should contain "true"
    But  the output should not contain "false"

Version data entries

38 entries across 38 versions & 8 rubygems

Version Path
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/rspec-mocks-2.14.4/features/outside_rspec/configuration.feature
dxruby_rp5-0.0.3 spec/vendor/rspec-mocks-2.14.4/features/outside_rspec/configuration.feature
tuktuk-rails-0.0.10 vendor/bundle/ruby/2.0.0/gems/rspec-mocks-2.14.4/features/outside_rspec/configuration.feature
tuktuk-rails-0.0.9 vendor/bundle/ruby/2.0.0/gems/rspec-mocks-2.14.4/features/outside_rspec/configuration.feature
tuktuk-rails-0.0.8 vendor/bundle/ruby/2.0.0/gems/rspec-mocks-2.14.4/features/outside_rspec/configuration.feature
tuktuk-rails-0.0.7 vendor/bundle/ruby/2.0.0/gems/rspec-mocks-2.14.4/features/outside_rspec/configuration.feature
dxruby_rp5-0.0.2 spec/vendor/rspec-mocks-2.14.4/features/outside_rspec/configuration.feature
dxruby_rp5-0.0.1 spec/vendor/rspec-mocks-2.14.4/features/outside_rspec/configuration.feature
mango-0.7.0 vendor/bundler/ruby/2.0.0/gems/rspec-mocks-2.14.4/features/outside_rspec/configuration.feature
rspec-mocks-2.99.0.beta1 features/outside_rspec/configuration.feature
rspec-mocks-2.14.4 features/outside_rspec/configuration.feature
clickable_link-0.0.2 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.14.3/features/outside_rspec/configuration.feature
syllable_counter-1.0.0 vendor/bundle/gems/rspec-mocks-2.14.3/features/outside_rspec/configuration.feature
rspec-mocks-2.14.3 features/outside_rspec/configuration.feature
rspec-mocks-2.14.2 features/outside_rspec/configuration.feature
rspec-mocks-2.14.1 features/outside_rspec/configuration.feature
rspec-mocks-2.14.0 features/outside_rspec/configuration.feature
rspec-mocks-2.14.0.rc1 features/outside_rspec/configuration.feature