Sha256: 851b40128d7f2c33ea1b9b847d0ad6b8d10ca27c974072c13c1a57f6f0f623cf

Contents?: true

Size: 1.73 KB

Versions: 150

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:
      """
      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:
      """
      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

150 entries across 96 versions & 14 rubygems

Version Path
classiccms-0.5.16 vendor/bundle/gems/rspec-mocks-2.10.1/features/argument_matchers/explicit.feature
classiccms-0.5.16 vendor/bundle/gems/rspec-mocks-2.9.0/features/argument_matchers/explicit.feature
classiccms-0.5.15 vendor/bundle/gems/rspec-mocks-2.10.1/features/argument_matchers/explicit.feature
classiccms-0.5.15 vendor/bundle/gems/rspec-mocks-2.9.0/features/argument_matchers/explicit.feature
classiccms-0.5.14 vendor/bundle/gems/rspec-mocks-2.10.1/features/argument_matchers/explicit.feature
classiccms-0.5.14 vendor/bundle/gems/rspec-mocks-2.9.0/features/argument_matchers/explicit.feature
classiccms-0.5.13 vendor/bundle/gems/rspec-mocks-2.9.0/features/argument_matchers/explicit.feature
classiccms-0.5.13 vendor/bundle/gems/rspec-mocks-2.10.1/features/argument_matchers/explicit.feature
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/rspec-mocks-2.11.1/features/argument_matchers/explicit.feature
classiccms-0.5.12 vendor/bundle/gems/rspec-mocks-2.10.1/features/argument_matchers/explicit.feature
classiccms-0.5.12 vendor/bundle/gems/rspec-mocks-2.9.0/features/argument_matchers/explicit.feature
classiccms-0.5.11 vendor/bundle/gems/rspec-mocks-2.9.0/features/argument_matchers/explicit.feature
classiccms-0.5.11 vendor/bundle/gems/rspec-mocks-2.10.1/features/argument_matchers/explicit.feature
classiccms-0.5.10 vendor/bundle/gems/rspec-mocks-2.9.0/features/argument_matchers/explicit.feature
classiccms-0.5.10 vendor/bundle/gems/rspec-mocks-2.10.1/features/argument_matchers/explicit.feature
classiccms-0.5.9 vendor/bundle/gems/rspec-mocks-2.10.1/features/argument_matchers/explicit.feature
classiccms-0.5.9 vendor/bundle/gems/rspec-mocks-2.9.0/features/argument_matchers/explicit.feature
classiccms-0.5.8 vendor/bundle/gems/rspec-mocks-2.10.1/features/argument_matchers/explicit.feature
classiccms-0.5.8 vendor/bundle/gems/rspec-mocks-2.9.0/features/argument_matchers/explicit.feature
rspec-mocks-2.11.2 features/argument_matchers/explicit.feature