Sha256: 6a31f699f31e963bcefd67fa6247e8c8bb1311bee4dabf4b1497d09830b56c67

Contents?: true

Size: 1.73 KB

Versions: 38

Compression:

Stored size: 1.73 KB

Contents

Feature: explicit arguments

  Allows you to explicitly specify the argument values

  Scenario: explicit arguments
    Given a file named "stub_explicit_args_spec.rb" with:
      """ruby
      describe "stubbed explicit arguments" do
        it "works on stubs" do
          object = Object.new
          object.stub(:foo).with(:this) do |arg|
            "got this"
          end
          object.stub(:foo).with(:that) do |arg|
            "got that"
          end

          object.foo(:this).should eq("got this")
          object.foo(:that).should eq("got that")
        end

        it "works on doubles and expectations" do
          object = double('foo')
          object.should_receive(:bar).with(:foo)

          object.bar(:foo)
        end
      end
      """
    When I run `rspec stub_explicit_args_spec.rb`
    Then the output should contain "2 examples, 0 failures"

  Scenario: explicit arguments with multiple arities
    Given a file named "stub_multiple_explicit_args_spec.rb" with:
      """ruby
      describe "stubbed multiple explicit arguments" do
        it "works on stubs" do
          object = Object.new
          object.stub(:foo).with(:this) do |arg|
            "got this"
          end
          object.stub(:foo).with(:this, :that) do |arg1, arg2|
            "got this and that"
          end

          object.foo(:this).should eq("got this")
          object.foo(:this, :that).should eq("got this and that")
        end

        it "works on mocks" do
          object = double('foo')
          object.should_receive(:foo).with(:this, :that)

          object.foo(:this, :that)
        end
      end
      """
    When I run `rspec stub_multiple_explicit_args_spec.rb`
    Then the output should contain "2 examples, 0 failures"

Version data entries

38 entries across 38 versions & 8 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rspec-mocks-2.14.6/features/argument_matchers/explicit.feature
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/rspec-mocks-2.14.6/features/argument_matchers/explicit.feature
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/rspec-mocks-2.14.6/features/argument_matchers/explicit.feature
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/argument_matchers/explicit.feature
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/argument_matchers/explicit.feature
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/argument_matchers/explicit.feature
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/argument_matchers/explicit.feature
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/argument_matchers/explicit.feature
rspec-mocks-2.99.4 features/argument_matchers/explicit.feature
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rspec-mocks-2.14.6/features/argument_matchers/explicit.feature
rspec-mocks-2.99.3 features/argument_matchers/explicit.feature
rspec-mocks-2.99.2 features/argument_matchers/explicit.feature
dxruby_rp5-0.0.4 spec/vendor/rspec-mocks-2.14.4/features/argument_matchers/explicit.feature
rspec-mocks-2.99.1 features/argument_matchers/explicit.feature
rspec-mocks-2.99.0 features/argument_matchers/explicit.feature
rspec-mocks-2.99.0.rc1 features/argument_matchers/explicit.feature
rspec-mocks-2.14.6 features/argument_matchers/explicit.feature
rspec-mocks-2.99.0.beta2 features/argument_matchers/explicit.feature
rspec-mocks-2.14.5 features/argument_matchers/explicit.feature
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/rspec-mocks-2.14.4/features/argument_matchers/explicit.feature