diff options
Diffstat (limited to 'spec/support/shared_examples/controllers/set_sort_order_from_user_preference_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/controllers/set_sort_order_from_user_preference_shared_examples.rb | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/spec/support/shared_examples/controllers/set_sort_order_from_user_preference_shared_examples.rb b/spec/support/shared_examples/controllers/set_sort_order_from_user_preference_shared_examples.rb index d86838719d4..98ab04c5636 100644 --- a/spec/support/shared_examples/controllers/set_sort_order_from_user_preference_shared_examples.rb +++ b/spec/support/shared_examples/controllers/set_sort_order_from_user_preference_shared_examples.rb @@ -2,18 +2,12 @@ shared_examples 'set sort order from user preference' do describe '#set_sort_order_from_user_preference' do # There is no issuable_sorting_field defined in any CE controllers yet, # however any other field present in user_preferences table can be used for testing. - let(:sorting_field) { :issue_notes_filter } - let(:sorting_param) { 'any' } - - before do - allow(controller).to receive(:issuable_sorting_field).and_return(sorting_field) - end context 'when database is in read-only mode' do it 'it does not update user preference' do allow(Gitlab::Database).to receive(:read_only?).and_return(true) - expect_any_instance_of(UserPreference).not_to receive(:update_attribute).with(sorting_field, sorting_param) + expect_any_instance_of(UserPreference).not_to receive(:update).with({ controller.send(:issuable_sorting_field) => sorting_param }) get :index, params: { namespace_id: project.namespace, project_id: project, sort: sorting_param } end @@ -23,7 +17,7 @@ shared_examples 'set sort order from user preference' do it 'updates user preference' do allow(Gitlab::Database).to receive(:read_only?).and_return(false) - expect_any_instance_of(UserPreference).to receive(:update_attribute).with(sorting_field, sorting_param) + expect_any_instance_of(UserPreference).to receive(:update).with({ controller.send(:issuable_sorting_field) => sorting_param }) get :index, params: { namespace_id: project.namespace, project_id: project, sort: sorting_param } end |