-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(subscription): fix running tests for subscription
- Loading branch information
Showing
1 changed file
with
12 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,6 +1,17 @@ | ||
require 'test_helper' | ||
|
||
class SubscriptionControllerTest < ActionController::TestCase | ||
setup do | ||
Rails.application.config.x.enable_email_subscription = true | ||
end | ||
|
||
test 'should fail if email subscription is disabled' do | ||
Rails.application.config.x.enable_email_subscription = false | ||
|
||
post :subscribe, params: { subscription: { email: '[email protected]', subtype: :body, query: 'BE' } } | ||
assert_response :not_implemented | ||
end | ||
|
||
test 'should create inactive subscription and optin when email is unknown' do | ||
post :subscribe, params: { subscription: { email: '[email protected]', subtype: :body, query: 'BE' } } | ||
assert_response :success | ||
|
@@ -36,4 +47,4 @@ class SubscriptionControllerTest < ActionController::TestCase | |
|
||
assert_not Subscription.find(sub.id).active?, 'subscription should now be inactive' | ||
end | ||
end | ||
end |