hi,
I''m trying to run specs for an observer thats included with a plugin.
There''s no guarantee the app has set the observer in its
environment.rb. I''m presently doing this but expect there''s a
more
elegant solution
unless ActiveRecord::Base.observers.include? :subscription_observer
puts "Cannot run specs on SubscriptionObserver. Please add the
following to environment.rb"
puts " config.active_record.observers = :subscription_observer"
else
describe SubscriptionObserver do
...
end
end
By the way, I did try enabling the observer for the duration of the
spec but that didnt work, eg
before :all do
ActiveRecord::Base.observers = [:subscription_observer]
end
thx
--linoj