RSpec allows you to get the current running test method name in a before(:each) block, by doing the following:
Spec::Runner.configure do |config|
config.before :each do |x|
x.method_name # returns 'should be cool'
end
end
This is for a test like:
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe 'Hello world' do
it 'should be cool' do
# test code
end
end
Would it be possible to get the whole test name with what it's describing, (a.k.a. 'Hello World should be cool') in the before block?