diff --git a/src/api/spec/controllers/webui/packages/bs_requests_controller_spec.rb b/src/api/spec/controllers/webui/packages/bs_requests_controller_spec.rb index 7c93b8e27c8..bb3721a8704 100644 --- a/src/api/spec/controllers/webui/packages/bs_requests_controller_spec.rb +++ b/src/api/spec/controllers/webui/packages/bs_requests_controller_spec.rb @@ -22,12 +22,6 @@ let!(:user) { create(:confirmed_user, login: 'king') } let(:params) { base_params.merge(context_params) } - before do - login user - Flipper.enable(:request_index, user) - get :index, params: params, format: :html - end - context 'when looking at the target_package requests' do let(:target_project) { create(:project_with_package) } let(:target_package) { target_project.packages.first } @@ -45,8 +39,20 @@ source_package: target_package, target_package: create(:project)) end + let!(:request_with_review) do + create(:bs_request_with_submit_action, + review_by_package: target_package, + creator: user, + priority: 'critical') + end let(:base_params) { { project: target_project, package: target_package, format: :json } } + before do + login user + Flipper.enable(:request_index, user) + get :index, params: params, format: :html + end + context 'and the direction parameters is "incoming"' do let(:context_params) { { direction: 'incoming' } } @@ -54,6 +60,7 @@ it { expect(subject).to render_template(:index) } it { expect(assigns[:bs_requests]).to include(incoming_request) } it { expect(assigns[:bs_requests]).not_to include(outgoing_request) } + it { expect(assigns[:bs_requests]).not_to include(request_with_review) } end context 'and the direction parameters is "outgoing"' do @@ -63,6 +70,7 @@ it { expect(subject).to render_template(:index) } it { expect(assigns[:bs_requests]).not_to include(incoming_request) } it { expect(assigns[:bs_requests]).to include(outgoing_request) } + it { expect(assigns[:bs_requests]).not_to include(request_with_review) } end context 'and the direction parameters is "all"' do @@ -72,6 +80,7 @@ it { expect(subject).to render_template(:index) } it { expect(assigns[:bs_requests]).to include(incoming_request) } it { expect(assigns[:bs_requests]).to include(outgoing_request) } + it { expect(assigns[:bs_requests]).to include(request_with_review) } end end @@ -92,8 +101,20 @@ source_package: source_package, target_package: create(:project)) end + let!(:request_with_review) do + create(:bs_request_with_submit_action, + review_by_package: source_package, + creator: user, + priority: 'critical') + end let(:base_params) { { project: source_project, package: source_package, format: :json } } + before do + login user + Flipper.enable(:request_index, user) + get :index, params: params, format: :html + end + context 'and the direction parameters is "incoming"' do let(:context_params) { { direction: 'incoming' } } @@ -101,6 +122,7 @@ it { expect(subject).to render_template(:index) } it { expect(assigns[:bs_requests]).not_to include(outgoing_request) } it { expect(assigns[:bs_requests]).to include(incoming_request) } + it { expect(assigns[:bs_requests]).not_to include(request_with_review) } end context 'and the direction parameters is "outgoing"' do @@ -110,6 +132,7 @@ it { expect(subject).to render_template(:index) } it { expect(assigns[:bs_requests]).not_to include(incoming_request) } it { expect(assigns[:bs_requests]).to include(outgoing_request) } + it { expect(assigns[:bs_requests]).not_to include(request_with_review) } end context 'and the direction parameters is "all"' do @@ -119,6 +142,7 @@ it { expect(subject).to render_template(:index) } it { expect(assigns[:bs_requests]).to include(incoming_request) } it { expect(assigns[:bs_requests]).to include(outgoing_request) } + it { expect(assigns[:bs_requests]).to include(request_with_review) } end end end diff --git a/src/api/spec/controllers/webui/projects/bs_requests_controller_spec.rb b/src/api/spec/controllers/webui/projects/bs_requests_controller_spec.rb index a7df9506d25..0cf0f9305f3 100644 --- a/src/api/spec/controllers/webui/projects/bs_requests_controller_spec.rb +++ b/src/api/spec/controllers/webui/projects/bs_requests_controller_spec.rb @@ -22,12 +22,6 @@ let!(:user) { create(:confirmed_user, login: 'king') } let(:params) { base_params.merge(context_params) } - before do - login user - Flipper.enable(:request_index, user) - get :index, params: params, format: :html - end - context 'when looking at the target_projects requests' do let(:target_project) { create(:project_with_package) } let(:target_package) { target_project.packages.first } @@ -45,8 +39,20 @@ source_package: target_package, target_package: create(:project)) end + let!(:request_with_review) do + create(:bs_request_with_submit_action, + review_by_project: target_project, + creator: user, + priority: 'critical') + end let(:base_params) { { project: target_project, format: :json } } + before do + login user + Flipper.enable(:request_index, user) + get :index, params: params, format: :html + end + context 'and the direction parameters is "incoming"' do let(:context_params) { { direction: 'incoming' } } @@ -54,6 +60,7 @@ it { expect(subject).to render_template(:index) } it { expect(assigns[:bs_requests]).to include(incoming_request) } it { expect(assigns[:bs_requests]).not_to include(outgoing_request) } + it { expect(assigns[:bs_requests]).not_to include(request_with_review) } end context 'and the direction parameters is "outgoing"' do @@ -63,6 +70,7 @@ it { expect(subject).to render_template(:index) } it { expect(assigns[:bs_requests]).not_to include(incoming_request) } it { expect(assigns[:bs_requests]).to include(outgoing_request) } + it { expect(assigns[:bs_requests]).not_to include(request_with_review) } end context 'and the direction parameters is "all"' do @@ -72,6 +80,7 @@ it { expect(subject).to render_template(:index) } it { expect(assigns[:bs_requests]).to include(incoming_request) } it { expect(assigns[:bs_requests]).to include(outgoing_request) } + it { expect(assigns[:bs_requests]).to include(request_with_review) } end end @@ -92,8 +101,20 @@ source_package: source_package, target_package: create(:project)) end + let!(:request_with_review) do + create(:bs_request_with_submit_action, + review_by_project: source_project, + creator: user, + priority: 'critical') + end let(:base_params) { { project: source_project, format: :json } } + before do + login user + Flipper.enable(:request_index, user) + get :index, params: params, format: :html + end + context 'and the direction parameters is "incoming"' do let(:context_params) { { direction: 'incoming' } } @@ -101,6 +122,7 @@ it { expect(subject).to render_template(:index) } it { expect(assigns[:bs_requests]).not_to include(outgoing_request) } it { expect(assigns[:bs_requests]).to include(incoming_request) } + it { expect(assigns[:bs_requests]).not_to include(request_with_review) } end context 'and the direction parameters is "outgoing"' do @@ -110,6 +132,7 @@ it { expect(subject).to render_template(:index) } it { expect(assigns[:bs_requests]).not_to include(incoming_request) } it { expect(assigns[:bs_requests]).to include(outgoing_request) } + it { expect(assigns[:bs_requests]).not_to include(request_with_review) } end context 'and the direction parameters is "all"' do @@ -119,6 +142,7 @@ it { expect(subject).to render_template(:index) } it { expect(assigns[:bs_requests]).to include(incoming_request) } it { expect(assigns[:bs_requests]).to include(outgoing_request) } + it { expect(assigns[:bs_requests]).to include(request_with_review) } end end end