docbrown/spec/workers/users/resave_articles_worker_spec.rb
Michael Kohl 4f68e1907e
Try out parallel Travis builds (#6645)
* Try out parallel Travis builds

* Add more Bundler options

* Appease the spec gods

I don't think we actually need Timecop.freeze in this spec

* Try inlining factories

* Make sure the time has actually changed

* Add CodeClimate coverage for parallel build

* Explicitly list jobs, don't rely on matrix expansion

* Merge master and move storybook to after_script

* Add missing environment variable

* Remove old cc-test-reporter config

* Move yarn build-storybook back to script, remove conditional coverage upload

* Actually remove yarn build-storybook from after_script

* Bump Octokit so we can build again

Co-authored-by: rhymes <rhymesete@gmail.com>
2020-04-14 10:25:53 -04:00

30 lines
711 B
Ruby

require "rails_helper"
RSpec.describe Users::ResaveArticlesWorker, type: :worker do
include_examples "#enqueues_on_correct_queue", "medium_priority", 1
describe "#perform" do
let(:worker) { subject }
context "with user" do
it "resave articles" do
user = create(:user)
article = create(:article, user: user)
old_updated_at = article.updated_at
Timecop.travel(1.minute.from_now) do
worker.perform(user.id)
end
expect(article.reload.updated_at).to be > old_updated_at
end
end
context "without user" do
it "does not break" do
expect { worker.perform(nil) }.not_to raise_error
end
end
end
end