about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorMatt Jankowski <mjankowski@thoughtbot.com>2017-05-22 17:12:29 -0400
committerEugen Rochko <eugen@zeonfederated.com>2017-05-22 23:12:28 +0200
commita28ce13b3e7da2159fdc4800214910740a66c3bf (patch)
tree97ade050c827dc7311e472c00e47bf6a90ab6d60 /spec
parente1b42e9aa01b0c6adab05afb9c5ee0cf9fbb41a9 (diff)
Coverage for api/web/settings controller (#3238)
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/api/web/settings_controller_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/controllers/api/web/settings_controller_spec.rb b/spec/controllers/api/web/settings_controller_spec.rb
new file mode 100644
index 000000000..ff211c7b1
--- /dev/null
+++ b/spec/controllers/api/web/settings_controller_spec.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe Api::Web::SettingsController do
+  render_views
+
+  let!(:user) { Fabricate(:user) }
+
+  describe 'PATCH #update' do
+    it 'redirects to about page' do
+      sign_in(user)
+      patch :update, format: :json, params: { data: { 'onboarded' => true } }
+
+      user.reload
+      expect(response).to have_http_status(:success)
+      expect(user_web_setting.data['onboarded']).to eq('true')
+    end
+
+    def user_web_setting
+      Web::Setting.where(user: user).first
+    end
+  end
+end