Permalink
Browse files

add wip feature for accessing running example

  • Loading branch information...
1 parent 81be938 commit 1fa1b565f159d6115444b4e11a7686b0b974fe7c @dchelimsky dchelimsky committed Mar 11, 2010
Showing with 48 additions and 0 deletions.
  1. +48 −0 features/matchers/access_running_example.feature
@@ -0,0 +1,48 @@
+@wip
+Feature: access running example
+
+ Scenario: matcher defined via DSL
+ Given a file named "example_spec.rb" with:
+ """
+ Rspec::Matchers.define :bar do
+ match do |_|
+ running_example.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: matcher defined via #new
+ Given a file named "example_spec.rb" with:
+ """
+ describe "something" do
+ def bar
+ Rspec::Matchers::Matcher.new :bar do
+ match do |_|
+ running_example.foo == "foo"
+ end
+ end
+ end
+
+ 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"

0 comments on commit 1fa1b56

Please sign in to comment.