Sha256: a584d0f79c65b2f59d5b33719b342927543dffca1ef839188aaf5eb3a32ebba3

Contents?: true

Size: 1.47 KB

Versions: 23

Compression:

Stored size: 1.47 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

23 entries across 23 versions & 3 rubygems

Version Path
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/rspec-mocks-2.1.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
vim-jar-0.1.2 bundler/ruby/1.8/gems/rspec-mocks-2.1.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
vim-jar-0.1.1 bundler/ruby/1.8/gems/rspec-mocks-2.1.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
vim-jar-0.1.0 bundler/ruby/1.8/gems/rspec-mocks-2.1.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
rspec-mocks-2.3.0 features/message_expectations/warn_when_expectation_is_set_on_nil.feature
vim-jar-0.0.3 bundler/ruby/1.8/gems/rspec-mocks-2.1.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
vim-jar-0.0.2 bundler/ruby/1.8/gems/rspec-mocks-2.1.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
vim-jar-0.0.1 bundler/ruby/1.8/gems/rspec-mocks-2.1.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
rspec-mocks-2.2.0 features/message_expectations/warn_when_expectation_is_set_on_nil.feature
rspec-mocks-2.1.0 features/message_expectations/warn_when_expectation_is_set_on_nil.feature
rspec-mocks-2.0.1 features/message_expectations/warn_when_expectation_is_set_on_nil.feature
gemrage-1.0.0 vendor/ruby/1.8/gems/rspec-mocks-2.0.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
gemrage-0.4.1 vendor/ruby/1.8/gems/rspec-mocks-2.0.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
gemrage-0.4.0 vendor/ruby/1.8/gems/rspec-mocks-2.0.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
gemrage-0.3.2 vendor/ruby/1.8/gems/rspec-mocks-2.0.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
gemrage-0.3.1 vendor/ruby/1.8/gems/rspec-mocks-2.0.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
gemrage-0.3.0 vendor/ruby/1.8/gems/rspec-mocks-2.0.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
gemrage-0.2.0 vendor/ruby/1.8/gems/rspec-mocks-2.0.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
gemrage-0.1.2 vendor/ruby/1.8/gems/rspec-mocks-2.0.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
gemrage-0.1.1 vendor/ruby/1.8/gems/rspec-mocks-2.0.0/features/message_expectations/warn_when_expectation_is_set_on_nil.feature