Testing code in at_exit with Rspec

602 views Asked by At

I have a ruby app that needs to, among other things, close some databases at exit. For this I use the at_exit method. The code looks something like this:

at_exit do
    close_databases
    #more code
    say_goodbye
end

require "gems"
#...code

I have specs for all the method calls used, but I would like to be able to test the code inside the at_exit method. Is it possible? If so, how can I write the specs for that?

0

There are 0 answers