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
Showing
5 changed files
with
117 additions
and
2 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
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 @@ | ||
# frozen_string_literal: true | ||
|
||
require "test_helper" | ||
|
||
class MediaSyncingControllerTest < ActionDispatch::IntegrationTest | ||
include ActiveJob::TestHelper | ||
|
||
test "should sync media" do | ||
login users(:admin) | ||
|
||
Media.stub(:syncing?, false) do | ||
assert_enqueued_with(job: MediaSyncJob) do | ||
post media_syncing_url | ||
end | ||
end | ||
end | ||
|
||
test "should only admin can sync media" do | ||
login | ||
|
||
post media_syncing_url | ||
assert_response :forbidden | ||
end | ||
|
||
test "should not sync media when the media is syncing" do | ||
login users(:admin) | ||
|
||
Media.stub(:syncing?, true) do | ||
assert_no_enqueued_jobs do | ||
post media_syncing_url | ||
end | ||
end | ||
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
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,22 @@ | ||
# frozen_string_literal: true | ||
|
||
require "test_helper" | ||
|
||
class MediaListenerTest < ActiveSupport::TestCase | ||
teardown do | ||
MediaListener.stop | ||
end | ||
|
||
test "start listening" do | ||
MediaListener.start | ||
|
||
assert MediaListener.running? | ||
end | ||
|
||
test "stop listening" do | ||
MediaListener.start | ||
MediaListener.stop | ||
|
||
assert_not MediaListener.running? | ||
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