Fix flakys specs

This commit is contained in:
taitus
2019-04-24 16:23:09 +02:00
committed by voodoorai2000
parent d2506358ef
commit 91ba5ff879
2 changed files with 11 additions and 3 deletions

View File

@@ -6,6 +6,10 @@ describe RemoteTranslationsCaller do
RemoteTranslation.skip_callback(:create, :after, :enqueue_remote_translation)
end
after do
RemoteTranslation.set_callback(:create, :after, :enqueue_remote_translation)
end
describe "#call" do
context "Debates" do

View File

@@ -30,14 +30,18 @@ describe RemoteTranslation do
describe "#enqueue_remote_translation" do
it "after create enqueue Delayed Job" do
before do
Delayed::Worker.delay_jobs = true
end
expect { remote_translation.save }.to change { Delayed::Job.count }.by(1)
after do
Delayed::Worker.delay_jobs = false
end
it "after create enqueue Delayed Job" do
expect { remote_translation.save }.to change { Delayed::Job.count }.by(1)
end
end
end