Skip to content

Commit

Permalink
test(subscription): fix running tests for subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
robbi5 committed Jun 27, 2020
1 parent fc72115 commit 3ad1a31
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/controllers/subscription_controller_test.rb
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
Expand Down Expand Up @@ -36,4 +47,4 @@ class SubscriptionControllerTest < ActionController::TestCase

assert_not Subscription.find(sub.id).active?, 'subscription should now be inactive'
end
end
end

0 comments on commit 3ad1a31

Please sign in to comment.