[rspec-users] List of examples

Иван Неверов ivan.neverov at gmail.com
Tue Jan 17 11:36:35 EST 2012


Hi all,

I want to write a test grid over rspec && spork.

For example we have grid with several nodes. Each has spork running on it.

Master node accept some filters like --tag tag:value to run
It select all examples for this conditions and distribute them through
nodes with syntax like
rspec path_to_test:line_number

Problem is following. I can get exact line for example with (in some method
like "list" in lib/rspec/core/world.rb)
filtered_examples.collect{|g,es| es}.flatten.uniq.compact.collect{|ex|
ex.location}

but if example group includes shared examples it get wrong line number
Explain on example:

1  shared_examples_for "a" do
2    context "one" do
3      it "shared" do
4      end
5    end
6    context 'two' do
7      it "shared1" do
8      end
9    end
10 end
11 describe "1" do
12   it_should_behave_like "a"
13 end
14 describe "2" do
15   it_should_behave_like "a"
16   it "three" do
17   end
18   it "four" do
19   end
20 end

Result is
test_spec.rb:3
test_spec.rb:7

But I can get all calling chain for Example (using metadata[:example_group])

Other case of problem we cannot run specific shared example in context of
some describe
For example for test above, run Example "shared" in context of ExampleGroup
"1".
Command rspec test_spec.rb:3 execute for all ExampleGroup's "1" and "2"

Maybe there is a syntax to run shared example in context of some
ExampleGroup, like:
rspec test_spec.rb:14:15:2:3
# to run "shared" in context of ExampleGroup "1"

rspec test_spec.rb:16,18
# to run Example's "three" and "four"

rspec test_spec.rb:14:15:2:3,11:12:6:7
# to run Example "shared" in context of ExampleGroup "2" and Example
"shared1" in context of ExampleGroup "1"

What do you think about all this.
Thanks.
Ivan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120117/3175f3c0/attachment.html>


More information about the rspec-users mailing list