Sha256: e9ed1a695d03b3da5174f6be3e38f1b14fe5b671b60a1362edcdd3ef2b38337c

Contents?: true

Size: 1.42 KB

Versions: 23

Compression:

Stored size: 1.42 KB

Contents

Feature: Access running example

  In order to take advantage of services that are available
    in my examples when I'm writing matchers
  As a spec author
  I want to call methods on the running example

  If the method exists in the context of the example, it gets
  called. If not, a NoMethodError is raised on the Matcher itself
  (not the example).

  Scenario: call method defined on example from matcher
    Given a file named "example_spec.rb" with:
      """
      RSpec::Matchers.define :bar do
        match do |_|
          foo == "foo"
        end
      end

      describe "something" do
        def foo
          "foo"
        end

        it "does something" do
          "foo".should bar
        end
      end
      """
    When I run "rspec ./example_spec.rb"
    Then the output should contain "1 example, 0 failures"

  Scenario: call method _not_ defined on example from matcher
    Given a file named "example_spec.rb" with:
      """
      RSpec::Matchers.define :bar do
        match do |_|
          foo == "foo"
        end
      end

      describe "something" do
        it "does something" do
          "foo".should bar
        end
      end
      """
    When I run "rspec ./example_spec.rb"
    Then the output should contain "1 example, 1 failure"
    And the output should contain "undefined local variable"
    And the output should contain "RSpec::Matchers::Matcher"
    And the output should not contain "ExampleGroup"

Version data entries

23 entries across 23 versions & 3 rubygems

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