settings_controller_spec.rb 537 B

123456789101112131415161718192021222324
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe Api::Web::SettingsController do
  4. render_views
  5. let!(:user) { Fabricate(:user) }
  6. describe 'PATCH #update' do
  7. it 'redirects to about page' do
  8. sign_in(user)
  9. patch :update, format: :json, params: { data: { 'onboarded' => true } }
  10. user.reload
  11. expect(response).to have_http_status(200)
  12. expect(user_web_setting.data['onboarded']).to eq('true')
  13. end
  14. def user_web_setting
  15. Web::Setting.where(user: user).first
  16. end
  17. end
  18. end