views:

107

answers:

2

if i have rspec like this

describe 'Foo' do
   // init go here
   describe 'Sub-Foo' do
      it "should Bar" do
         // test go here
         // puts ... <-- need "Foo.Sub-Foo should Bar" here 
      end
   end
end

How can i get "Foo.Sub-Foo should Bar" inside the test context at // test go here?

It is similar to format with specdocs, but how to get it inside itself?

A: 

Why would you want to do that?! It is not relevant to your test.

Ariejan
Well, I want to printout a result from test test. e.g. url of completed test object.
Jirapong
Sorry, I don't understand what you want.
Ariejan
Sorry, may be my question is not clear. how about now?
Jirapong
+3  A: 
describe 'Foo' do
   describe 'Sub-Foo' do
      it "should Bar" do
         puts "#{self.class.description} #{description}"
      end
   end
end

The above code prints out "Foo Sub-Foo should Bar".

mtyaka
It is what i looking for. Thanks
Jirapong