I have issue with execution of shared examples.The shared example always gets executed at the end in the list of examples. How to run all the examples in the order ?
I have shared example spec which looks like
sharedExamples_spec.rb
shared_examples "upload jar" do |msg|
it "shared examples group" do
sleep(10)
p "hello there :2 #{msg}"
end
end
And in other spec file
require 'sharedExamples_spec.rb'
describe "something" do
before(:each) do
@spec = "something group"
end
it "1: does something" do
puts "hello there:1 #{@spec}"
end
describe "shared example" do
it_should_behave_like "upload jar"," shared group"
end
it "3: does something" do
puts "hello there:3 #{@spec}"
end
end
Rspec Output I get is
something
hello there:1 something group
1: does something
hello there:3 something group
3: does something
shared example
it should behave like upload jar
"hello there :2 shared group"
shared examples group
Finished in 1 second
3 examples, 0 failures
If you see the the output, Shared examples is executed as the last example. Can anyone please suggest how to execute the test in the order that is written.