about summary refs log tree commit diff
path: root/spec/controllers/api/web/settings_controller_spec.rb
blob: 815da04c47785413972971c0f62c4816750c5607 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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(200)
      expect(user_web_setting.data['onboarded']).to eq('true')
    end

    def user_web_setting
      Web::Setting.where(user: user).first
    end
  end
end