Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add wip feature for accessing running example

  • Loading branch information...
commit 1fa1b565f159d6115444b4e11a7686b0b974fe7c 1 parent 81be938
@dchelimsky dchelimsky authored
Showing with 48 additions and 0 deletions.
  1. +48 −0 features/matchers/access_running_example.feature
View
48 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"
Please sign in to comment.
Something went wrong with that request. Please try again.