[rspec-users] Global setup method goes where?

Mikel Lindsaar raasdnil at gmail.com
Fri Jul 4 02:30:18 EDT 2008

On Fri, Jul 4, 2008 at 4:19 PM, Ben Mabey <ben at benmabey.com> wrote:
> Gregg Pollack wrote:
>> I found this post which shows how to get test information printed out in
>> your test.log with test:unit and shoulda, but I'm not sure there's a way
>> to do it with RSpec.

Damn, that is a good idea.

> In your spec_helper.rb just put:
> Spec::Runner.configure do |config|
>  ...
>  config.before(:each) do
>     full_example_description = "#{self.class.description} #{@method_name}"
>     RAILS_DEFAULT_LOGGER.info("\n\nStarting
> #{full_example_description}\n\n#{'-' * (9 +
> full_example_description.length)}")
>  end
> end

Beaten at the gate by about 30 seconds :)  My implementation was
basically the same!

> Note that the constant RAILS_DEFAULT_LOGGER is being used since
> Rails::logger is only available in 2.1.

Didn't think of that bit though.  Well done.

Rails, RSpec, Puppet and Life blog....

More information about the rspec-users mailing list