Merge commit '9c2d5b534f
' into upstream-20250314
This commit is contained in:
commit
6548462ecb
84 changed files with 1719 additions and 418 deletions
|
@ -1,25 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::Settings::BrandingController do
|
||||
render_views
|
||||
|
||||
describe 'When signed in as an admin' do
|
||||
before do
|
||||
sign_in Fabricate(:admin_user), scope: :user
|
||||
end
|
||||
|
||||
describe 'PUT #update' do
|
||||
it 'cannot create a setting value for a non-admin key' do
|
||||
expect(Setting.new_setting_key).to be_blank
|
||||
|
||||
patch :update, params: { form_admin_settings: { new_setting_key: 'New key value' } }
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(400)
|
||||
expect(Setting.new_setting_key).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -15,6 +15,7 @@ RSpec.describe Api::Web::PushSubscriptionsController do
|
|||
p256dh: 'BEm_a0bdPDhf0SOsrnB2-ategf1hHoCnpXgQsFj5JCkcoMrMt2WHoPfEYOYPzOIs9mZE8ZUaD7VA5vouy0kEkr8=',
|
||||
auth: 'eH_C8rq2raXqlcBVDa1gLg==',
|
||||
},
|
||||
standard: standard,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
@ -36,6 +37,7 @@ RSpec.describe Api::Web::PushSubscriptionsController do
|
|||
},
|
||||
}
|
||||
end
|
||||
let(:standard) { '1' }
|
||||
|
||||
before do
|
||||
sign_in(user)
|
||||
|
@ -51,14 +53,27 @@ RSpec.describe Api::Web::PushSubscriptionsController do
|
|||
|
||||
user.reload
|
||||
|
||||
expect(created_push_subscription).to have_attributes(
|
||||
endpoint: eq(create_payload[:subscription][:endpoint]),
|
||||
key_p256dh: eq(create_payload[:subscription][:keys][:p256dh]),
|
||||
key_auth: eq(create_payload[:subscription][:keys][:auth])
|
||||
)
|
||||
expect(created_push_subscription)
|
||||
.to have_attributes(
|
||||
endpoint: eq(create_payload[:subscription][:endpoint]),
|
||||
key_p256dh: eq(create_payload[:subscription][:keys][:p256dh]),
|
||||
key_auth: eq(create_payload[:subscription][:keys][:auth])
|
||||
)
|
||||
.and be_standard
|
||||
expect(user.session_activations.first.web_push_subscription).to eq(created_push_subscription)
|
||||
end
|
||||
|
||||
context 'when standard is provided as false value' do
|
||||
let(:standard) { '0' }
|
||||
|
||||
it 'saves push subscription with standard as false' do
|
||||
post :create, format: :json, params: create_payload
|
||||
|
||||
expect(created_push_subscription)
|
||||
.to_not be_standard
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a user who has a session with a prior subscription' do
|
||||
let!(:prior_subscription) { Fabricate(:web_push_subscription, session_activation: user.session_activations.last) }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue