Sha256: d2c4af1f4a1e70e9d6966fef58d5e95d4070087c76100646105da31868ac3ddb

Contents?: true

Size: 1.46 KB

Versions: 154

Compression:

Stored size: 1.46 KB

Contents

Feature: warn when expectation is set on nil

  Scenario: nil instance variable
    Given a file named "example_spec.rb" with:
      """
      RSpec.configure {|c| c.mock_with :rspec}
      describe "something" do
        it "does something" do
          @i_do_not_exist.should_receive(:foo)
          @i_do_not_exist.foo
        end
      end
      """
    When I run `rspec example_spec.rb`
    Then the output should contain "An expectation of :foo was set on nil"

  Scenario: allow
    Given a file named "example_spec.rb" with:
      """
      RSpec.configure {|c| c.mock_with :rspec}
      describe "something" do
        it "does something" do
          allow_message_expectations_on_nil
          nil.should_receive(:foo)
          nil.foo
        end
      end
      """
    When I run `rspec example_spec.rb`
    Then the output should not contain "An expectation"

  Scenario: allow in one example, but not on another
    Given a file named "example_spec.rb" with:
      """
      RSpec.configure {|c| c.mock_with :rspec}
      describe "something" do
        it "does something (foo)" do
          allow_message_expectations_on_nil
          nil.should_receive(:foo)
          nil.foo
        end
        it "does something (bar)" do
          nil.should_receive(:bar)
          nil.bar
        end
      end
      """
    When I run `rspec example_spec.rb`
    Then the output should contain "An expectation of :bar"
    And  the output should not contain "An expectation of :foo"

Version data entries

154 entries across 100 versions & 14 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/rspec-mocks-2.10.1/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
classiccms-0.7.5 vendor/bundle/gems/rspec-mocks-2.9.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
classiccms-0.7.4 vendor/bundle/gems/rspec-mocks-2.10.1/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
classiccms-0.7.4 vendor/bundle/gems/rspec-mocks-2.9.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
classiccms-0.7.3 vendor/bundle/gems/rspec-mocks-2.10.1/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
classiccms-0.7.3 vendor/bundle/gems/rspec-mocks-2.9.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.11.3/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
tnargav-1.2.3 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.11.3/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
classiccms-0.7.2 vendor/bundle/gems/rspec-mocks-2.10.1/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
classiccms-0.7.2 vendor/bundle/gems/rspec-mocks-2.9.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
classiccms-0.7.1 vendor/bundle/gems/rspec-mocks-2.10.1/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
classiccms-0.7.1 vendor/bundle/gems/rspec-mocks-2.9.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
classiccms-0.7.0 vendor/bundle/gems/rspec-mocks-2.10.1/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
classiccms-0.7.0 vendor/bundle/gems/rspec-mocks-2.9.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.10.1/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
classiccms-0.6.9 vendor/bundle/gems/rspec-mocks-2.10.1/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
classiccms-0.6.9 vendor/bundle/gems/rspec-mocks-2.9.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
classiccms-0.6.8 vendor/bundle/gems/rspec-mocks-2.10.1/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
classiccms-0.6.8 vendor/bundle/gems/rspec-mocks-2.9.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
classiccms-0.6.7 vendor/bundle/gems/rspec-mocks-2.9.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature