prevent spec flicker by cleaning up after Setting.notified_events

pull/3347/merge
Jens Ulferts 9 years ago
parent b6e8891d66
commit e03e1e99df
  1. 6
      spec/controllers/work_packages/creation_spec.rb
  2. 2
      spec/legacy/functional/messages_controller_spec.rb
  3. 2
      spec/models/mail_handler_spec.rb
  4. 6
      spec/models/setting_spec.rb

@ -36,6 +36,8 @@ describe WorkPackagesController, type: :controller do
before do
allow(User).to receive(:current).and_return user
expect(controller).to receive(:authorize).and_return(true)
expect(Setting).to receive(:notified_events).and_return ['work_package_added',
'work_package_updated']
end
around(:each) do |example|
@ -73,9 +75,7 @@ describe WorkPackagesController, type: :controller do
# Find the enqueued job responsible for sending the notification
# for the creation of the work package.
Delayed::Job.all.map(&:payload_object).detect do |job|
if job.is_a? EnqueueWorkPackageNotificationJob
job.send(:work_package) == work_package
end
job.is_a?(EnqueueWorkPackageNotificationJob) && job.send(:work_package) == work_package
end
end

@ -89,7 +89,7 @@ describe MessagesController, type: :controller do
it 'should post create' do
session[:user_id] = 2
ActionMailer::Base.deliveries.clear
Setting.notified_events = ['message_posted']
allow(Setting).to receive(:notified_events).and_return ['message_posted']
post :create, board_id: 1,
message: { subject: 'Test created message',

@ -67,7 +67,7 @@ describe MailHandler, type: :model do
before do
ActionMailer::Base.deliveries.clear
Setting.notified_events = Redmine::Notifiable.all.map(&:name)
allow(Setting).to receive(:notified_events).and_return(Redmine::Notifiable.all.map(&:name))
# we need both of these run first so the anonymous user is created and
# there is a default work package priority to save any work packages
priority_low

@ -100,6 +100,9 @@ describe Setting, type: :model do
after do
Setting.find_by_name('notified_events').destroy
# have to clear the cache as well
# as settings are stored there
Rails.cache.clear
end
end
@ -166,6 +169,9 @@ describe Setting, type: :model do
after do
Setting.destroy_all
# have to clear the cache as well
# as settings are stored there
Rails.cache.clear
end
end

Loading…
Cancel
Save