Reputation: 2228
I want to show each example's description in the Rails log during debugging. I can't quite figure out how this is done. I've looked at using RSpec.configure doing something like this:
RSpec.configure do |config|
config.before(:each) do |example|
Rails.logger.debug example.description
end
end
but that just gives a NoMethodError as it can't find description at that point. I thought it might work like #around does, but I guess not.
Upvotes: 3
Views: 1441
Reputation: 6346
You're pretty close, the following will output your test descriptions as they're run:
RSpec.configure do |config|
config.before(:each) do
Rails.logger.debug self.class.description
end
end
Source: http://benmabey.com/2008/07/04/global-setup-in-rspec-or-how-to-add-logging-for-specs.html
Upvotes: 3