2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe DashboardController do
|
2018-11-29 20:51:05 +05:30
|
|
|
context 'signed in' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-11-29 20:51:05 +05:30
|
|
|
before do
|
|
|
|
project.add_maintainer(user)
|
|
|
|
sign_in(user)
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-11-29 20:51:05 +05:30
|
|
|
describe 'GET issues' do
|
|
|
|
it_behaves_like 'issuables list meta-data', :issue, :issues
|
|
|
|
it_behaves_like 'issuables requiring filter', :issues
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-11-29 20:51:05 +05:30
|
|
|
describe 'GET merge requests' do
|
|
|
|
it_behaves_like 'issuables list meta-data', :merge_request, :merge_requests
|
|
|
|
it_behaves_like 'issuables requiring filter', :merge_requests
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
2018-11-29 20:51:05 +05:30
|
|
|
|
|
|
|
it_behaves_like 'authenticates sessionless user', :issues, :atom, author_id: User.first
|
|
|
|
it_behaves_like 'authenticates sessionless user', :issues_calendar, :ics
|
2019-05-18 00:54:41 +05:30
|
|
|
|
|
|
|
describe "#check_filters_presence!" do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
get :merge_requests, params: params
|
|
|
|
end
|
|
|
|
|
|
|
|
context "no filters" do
|
|
|
|
let(:params) { {} }
|
|
|
|
|
|
|
|
it 'sets @no_filters_set to false' do
|
|
|
|
expect(assigns[:no_filters_set]).to eq(true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "scalar filters" do
|
|
|
|
let(:params) { { author_id: user.id } }
|
|
|
|
|
|
|
|
it 'sets @no_filters_set to false' do
|
|
|
|
expect(assigns[:no_filters_set]).to eq(false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "array filters" do
|
|
|
|
let(:params) { { label_name: ['bug'] } }
|
|
|
|
|
|
|
|
it 'sets @no_filters_set to false' do
|
|
|
|
expect(assigns[:no_filters_set]).to eq(false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|