Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

hook to after :suite in separate module #1054

Closed
icotanchev opened this issue Aug 22, 2013 · 1 comment
Closed

hook to after :suite in separate module #1054

icotanchev opened this issue Aug 22, 2013 · 1 comment

Comments

@icotanchev
Copy link

I am trying to hooked on after(:suite) in separate module , the reason is to print a hash with values, but nothing happened :( .

module MyModule
  extend ActiveSupport::Concern
  self.included do
    instance_eval do
      after :all do
      pretty_print(@some_hash)      
      end
      after :suite do
        pretty_print(@some_other_hash)      
      end
    end
  end
end

The hash from "after :all" is printing after every spec as it should be, but when I am trying to print the hash from "after :suite" after all specs nothing happens.

@myronmarston
Copy link
Member

after(:suite) hooks are global (they run after the entire suite, after all) and are designed only to be used from RSpec.configure:

RSpec.configure do |c|
  c.after(:suite) do
    # ...
  end
end

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants