To add a collaborator to this project you will need to use the Relish gem to add the collaborator via a terminal command. Soon you'll be able to also add collaborators here!
More about adding a collaboratorexample name option
Use the --example (or -e) option to filter the examples to be run by name.
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.
- Background
-
- Given
-
a file named "first_spec.rb" with:
describe "first group" do it "first example in first group" do; end it "second example in first group" do; end end
- And
-
a file named "second_spec.rb" with:
describe "second group" do it "first example in second group" do; end it "second example in second group" do; end end
- And
-
a file named "third_spec.rb" with:
describe "third group" do it "first example in third group" do; end context "nested group" do it "first example in nested group" do; end it "second example in nested group" do; end end end
- And
-
a file named "fourth_spec.rb" with:
describe Array do describe "#length" do it "is the number of items" do Array.new([1,2,3]).length.should eq 3 end end end
- Scenarios
-
- no matches
- match on one word
- one match in each context
- one match in one file using just the example name
- one match in one file using the example name and the group name
- one match in one file using regexp
- all examples in one group
- one match in one file with group name
- all examples in one group including examples in nested groups
- Object#method
- no matches
-
- When
- I run "rspec . --example nothing_like_this"
- Then
- the output should contain "0 examples, 0 failures"
- match on one word
-
- When
- I run "rspec . --example example"
- Then
- the output should contain "7 examples, 0 failures"
- one match in each context
-
- When
- I run "rspec . --example 'first example'"
- Then
- the output should contain "4 examples, 0 failures"
- one match in one file using just the example name
-
- When
- I run "rspec . --example 'first example in first group'"
- Then
- the output should contain "1 example, 0 failures"
- one match in one file using the example name and the group name
-
- When
- I run "rspec . --example 'first group first example in first group'"
- Then
- the output should contain "1 example, 0 failures"
- one match in one file using regexp
-
- When
- I run "rspec . --example 'first .* first example'"
- Then
- the output should contain "1 example, 0 failures"
- all examples in one group
-
- When
- I run "rspec . --example 'first group'"
- Then
- the output should contain "2 examples, 0 failures"
- one match in one file with group name
-
- When
- I run "rspec . --example 'second group first example'"
- Then
- the output should contain "1 example, 0 failures"
- all examples in one group including examples in nested groups
-
- When
- I run "rspec . --example 'third group'"
- Then
- the output should contain "3 examples, 0 failures"
- Object#method
-
- When
- I run "rspec . --example 'Array#length'"
- Then
- the output should contain "1 example, 0 failures"
Last published over 7 years ago by .