-
Notifications
You must be signed in to change notification settings - Fork 71
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
dce7aa6
commit 432e576
Showing
10 changed files
with
115 additions
and
200 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
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,28 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'test_helper' | ||
require 'supports/mock_env_helper' | ||
|
||
class Scheduler::Daily::AutoRetireTest < ActionDispatch::IntegrationTest | ||
include MockEnvHelper | ||
|
||
test 'token evaluation' do | ||
# サーバー側のTOKENが未設定 | ||
mock_env('TOKEN' => '') do | ||
get scheduler_daily_auto_retire_path(token: '') | ||
assert_response 401 | ||
end | ||
|
||
mock_env('TOKEN' => 'token') do | ||
# リクエストで指定したtokenが不正 | ||
get scheduler_daily_auto_retire_path(token: 'invalid') | ||
assert_response 401 | ||
|
||
# tokenが正しい | ||
Scheduler::Daily::AutoRetireController.stub_any_instance(:auto_retire) do | ||
get scheduler_daily_auto_retire_path(token: 'token') | ||
assert_response 200 | ||
end | ||
end | ||
end | ||
end |
28 changes: 28 additions & 0 deletions
28
test/integration/scheduler/daily/fetch_external_entry_test.rb
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,28 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'test_helper' | ||
require 'supports/mock_env_helper' | ||
|
||
class Scheduler::Daily::FetchExternalEntryTest < ActionDispatch::IntegrationTest | ||
include MockEnvHelper | ||
|
||
test 'token evaluation' do | ||
# サーバー側のTOKENが未設定 | ||
mock_env('TOKEN' => '') do | ||
get scheduler_daily_fetch_external_entry_path(token: '') | ||
assert_response 401 | ||
end | ||
|
||
mock_env('TOKEN' => 'token') do | ||
# リクエストで指定したtokenが不正 | ||
get scheduler_daily_fetch_external_entry_path(token: 'invalid') | ||
assert_response 401 | ||
|
||
# tokenが正しい | ||
ExternalEntry.stub(:fetch_and_save_rss_feeds, nil) do | ||
get scheduler_daily_fetch_external_entry_path(token: 'token') | ||
assert_response 200 | ||
end | ||
end | ||
end | ||
end |
28 changes: 28 additions & 0 deletions
28
test/integration/scheduler/daily/notify_certain_period_passed_after_last_answer_test.rb
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,28 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'test_helper' | ||
require 'supports/mock_env_helper' | ||
|
||
class Scheduler::Daily::NotifyCertainPeriodPassedAfterLastAnswerTest < ActionDispatch::IntegrationTest | ||
include MockEnvHelper | ||
|
||
test 'token evaluation' do | ||
# サーバー側のTOKENが未設定 | ||
mock_env('TOKEN' => '') do | ||
get scheduler_daily_notify_certain_period_passed_after_last_answer_path(token: '') | ||
assert_response 401 | ||
end | ||
|
||
mock_env('TOKEN' => 'token') do | ||
# リクエストで指定したtokenが不正 | ||
get scheduler_daily_notify_certain_period_passed_after_last_answer_path(token: 'invalid') | ||
assert_response 401 | ||
|
||
# tokenが正しい | ||
Question.stub(:notify_certain_period_passed_after_last_answer, nil) do | ||
get scheduler_daily_notify_certain_period_passed_after_last_answer_path(token: 'token') | ||
assert_response 200 | ||
end | ||
end | ||
end | ||
end |
28 changes: 28 additions & 0 deletions
28
test/integration/scheduler/daily/notify_coming_soon_regular_events_test.rb
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,28 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'test_helper' | ||
require 'supports/mock_env_helper' | ||
|
||
class Scheduler::Daily::NotifyComingSoonRegularEventsTest < ActionDispatch::IntegrationTest | ||
include MockEnvHelper | ||
|
||
test 'token evaluation' do | ||
# サーバー側のTOKENが未設定 | ||
mock_env('TOKEN' => '') do | ||
get scheduler_daily_notify_coming_soon_regular_events_path(token: '') | ||
assert_response 401 | ||
end | ||
|
||
mock_env('TOKEN' => 'token') do | ||
# リクエストで指定したtokenが不正 | ||
get scheduler_daily_notify_coming_soon_regular_events_path(token: 'invalid') | ||
assert_response 401 | ||
|
||
# tokenが正しい | ||
Scheduler::Daily::NotifyComingSoonRegularEventsController.stub_any_instance(:notify_coming_soon_regular_events) do | ||
get scheduler_daily_notify_coming_soon_regular_events_path(token: 'token') | ||
assert_response 200 | ||
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
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