From 3ad1a316b265976d24d215643a5971ed85d10a82 Mon Sep 17 00:00:00 2001 From: Maximilian Richt Date: Sat, 27 Jun 2020 18:30:13 +0200 Subject: [PATCH] test(subscription): fix running tests for subscription --- test/controllers/subscription_controller_test.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/controllers/subscription_controller_test.rb b/test/controllers/subscription_controller_test.rb index 80d5bb6..3391d45 100644 --- a/test/controllers/subscription_controller_test.rb +++ b/test/controllers/subscription_controller_test.rb @@ -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: 'fresh@example.org', 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: 'fresh@example.org', 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 \ No newline at end of file