Sha256: 19d40ec7cb393bf00d8f01c51b41826d39928f88bacb88d5dabeaa7408bb5c56
Contents?: true
Size: 1.35 KB
Versions: 4
Compression:
Stored size: 1.35 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 I should see "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 I should see "1 example, 1 failure" And I should see "undefined local variable" And I should see "Rspec::Matchers::Matcher" And I should not see "ExampleGroup"
Version data entries
4 entries across 4 versions & 1 rubygems