-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
935f44f
commit 2c9c1d0
Showing
2 changed files
with
34 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require_relative '../test_helper' | ||
|
||
class GenericWorkerHelpersTest < ActionView::TestCase | ||
def setup | ||
require 'sidekiq/testing' | ||
Sidekiq::Worker.clear_all | ||
end | ||
|
||
def teardown | ||
end | ||
|
||
test "should run a job, without raising an error, for a method that takes a hash as a parameter" do | ||
Sidekiq::Testing.inline! | ||
|
||
assert_difference "Team.where(name: 'BackgroundTeam', slug: 'background-team').count" do | ||
Team.run_later('create!', name: 'BackgroundTeam', slug: 'background-team') | ||
end | ||
end | ||
|
||
test "should run a job, without raising an error, for a method that takes standalone parameters" do | ||
Sidekiq::Testing.inline! | ||
|
||
team = create_team | ||
project = create_project team: team | ||
pm = create_project_media project: project | ||
|
||
project_media_id = pm.id | ||
tags_json = ['one', 'two', 'three'].to_json | ||
|
||
ProjectMedia.run_later_in(0.second, 'create_tags', project_media_id, tags_json, user_id: pm.user_id) | ||
|
||
assert_equal 3, pm.annotations('tag').count | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters