Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

update line number feature

  • Loading branch information...
commit 69e6320b71c7d504710b295b78ec14b626e03366 1 parent 66c1901
@dchelimsky dchelimsky authored
View
6 features/command_line/example_name_option.feature
@@ -2,9 +2,9 @@ Feature: example name option
Use the --example (or -e) option to filter the examples to be run by name.
- The submitted argument is compiled to a Ruby Regexp, and matched against the
- full description of the example, which is the concatenation of descriptions
- of the group (including any nested groups) and the example.
+ The argument is compiled to a Ruby Regexp, and matched against the full
+ description of the example, which is the concatenation of descriptions of the
+ group (including any nested groups) and the example.
This allows you to run a single uniquely named example, all examples with
similar names, all the example in a uniquely named group, etc, etc.
View
42 features/command_line/line_number_appended_to_path.feature
@@ -7,33 +7,53 @@ Feature: line number appended to file path
Background:
Given a file named "example_spec.rb" with:
"""
- describe "a group" do
+ describe "outer group" do
- it "has a first example" do
+ it "first example in outer group" do
end
- it "has a second example" do
+ it "second example in outer group" do
end
+
+ describe "nested group" do
+
+ it "example in nested group" do
+
+ end
+ end
+
end
"""
- Scenario: two examples - both examples from the group declaration
+@wip
+ Scenario: nested groups - outer group on declaration line
When I run "rspec example_spec.rb:1 --format doc"
- Then I should see "2 examples, 0 failures"
- And I should see "has a second example"
- And I should see "has a first example"
+ Then I should see "3 examples, 0 failures"
+ And I should see "second example in outer group"
+ And I should see "first example in outer group"
+ And I should see "example in nested group"
+
+@wip
+ Scenario: nested groups - inner group on declaration line
+ When I run "rspec example_spec.rb:11 --format doc"
+ Then I should see "3 examples, 0 failures"
+ And I should see "example in nested group"
+ And I should not see "second example in outer group"
+ And I should not see "first example in outer group"
Scenario: two examples - first example on declaration line
When I run "rspec example_spec.rb:3 --format doc"
Then I should see "1 example, 0 failures"
- And I should see "has a first example"
- But the stdout should not contain "has a second example"
+ And I should see "first example in outer group"
+ But I should not see "second example in outer group"
+ And I should not see "example in nested group"
Scenario: two examples - second example on declaration line
When I run "rspec example_spec.rb:7 --format doc"
Then I should see "1 example, 0 failures"
- And I should see "has a second example"
- But the stdout should not contain "has a first example"
+ And I should see "second example in outer group"
+ But I should not see "first example in outer group"
+ And I should not see "example in nested group"
View
2  lib/rspec/core/configuration.rb
@@ -188,7 +188,7 @@ def output
$stdout
end
- def puts(msg='')
+ def puts(msg="")
output.puts(msg)
end
View
12 lib/rspec/core/metadata.rb
@@ -77,6 +77,12 @@ def configure_for_example(description, options)
update(options)
end
+ def all_apply?(filters)
+ filters.all? do |filter_on, filter|
+ apply_condition(filter_on, filter)
+ end
+ end
+
def apply_condition(filter_on, filter, metadata=nil)
metadata ||= self
case filter
@@ -97,12 +103,6 @@ def apply_condition(filter_on, filter, metadata=nil)
end
end
- def all_apply?(filters)
- filters.all? do |filter_on, filter|
- apply_condition(filter_on, filter)
- end
- end
-
private
def superclass_metadata
View
4 spec/ruby_forker.rb
@@ -2,7 +2,7 @@
module RubyForker
# Forks a ruby interpreter with same type as ourself.
- # juby will fork jruby, ruby will fork ruby etc.
+ # jruby will fork jruby, ruby will fork ruby etc.
def ruby(args, stderr=nil)
config = ::Config::CONFIG
interpreter = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
@@ -10,4 +10,4 @@ def ruby(args, stderr=nil)
cmd << " 2> #{stderr}" unless stderr.nil?
`#{cmd}`
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.