Commit df08b4ff authored by Felipe Artur's avatar Felipe Artur

Move quality_test_cases factory to EE folder

Move test cases related specs and factory to EE folder
parent 5ac5f7f3
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe DashboardController do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
context 'signed in' do
before do
project.add_developer(user)
sign_in(user)
end
describe 'GET issues' do
it 'does not list test cases' do
issue = create(:incident, project: project, author: user)
incident = create(:incident, project: project, author: user)
create(:quality_test_case, project: project, author: user)
get :issues, params: { author_id: user.id }
expect(assigns(:issues)).to match_array([issue, incident])
end
end
end
end
......@@ -19,6 +19,18 @@ RSpec.describe GroupsController do
it_behaves_like 'namespace storage limit alert'
end
describe 'GET #issues' do
it 'does not list test cases' do
issue = create(:issue, project: project, title: 'foo')
incident = create(:incident, project: project)
create(:quality_test_case, project: project)
get :issues, params: { id: group.to_param }
expect(assigns(:issues)).to match_array([issue, incident])
end
end
describe 'GET #activity' do
render_views
......
......@@ -9,3 +9,9 @@ FactoryBot.modify do
end
end
end
FactoryBot.define do
factory :quality_test_case, parent: :issue do
issue_type { :test_case }
end
end
......@@ -936,4 +936,20 @@ RSpec.describe Issue do
end
end
end
describe '.with_issue_type' do
let_it_be(:project) { create(:project) }
let_it_be(:issue) { create(:issue, project: project) }
let_it_be(:test_case) { create(:quality_test_case, project: project) }
it 'gives issues with test case type' do
expect(described_class.with_issue_type('test_case'))
.to contain_exactly(test_case)
end
it 'gives issues with the given issue types list' do
expect(described_class.with_issue_type(%w(issue test_case)))
.to contain_exactly(issue, test_case)
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Projects::OpenIssuesCountService, :use_clean_rails_memory_store_caching do
let(:project) { create(:project) }
describe '#count' do
it 'does not count test cases' do
create(:issue, :opened, project: project)
create(:incident, :opened, project: project)
create(:quality_test_case, :opened, project: project)
expect(described_class.new(project).count).to eq(2)
end
end
end
......@@ -15,16 +15,6 @@ RSpec.describe DashboardController do
describe 'GET issues' do
it_behaves_like 'issuables list meta-data', :issue, :issues
it_behaves_like 'issuables requiring filter', :issues
it 'lists only incidents and issues' do
issue = create(:incident, project: project, author: user)
incident = create(:incident, project: project, author: user)
create(:quality_test_case, project: project, author: user)
get :issues, params: { author_id: user.id }
expect(assigns(:issues)).to match_array([issue, incident])
end
end
describe 'GET merge requests' do
......
......@@ -400,15 +400,6 @@ RSpec.describe GroupsController, factory_default: :keep do
sign_in(user)
end
it 'lists only incidents and issues' do
incident = create(:incident, project: project)
create(:quality_test_case, project: project)
get :issues, params: { id: group.to_param }
expect(assigns(:issues)).to match_array([issue_1, issue_2, incident])
end
context 'sorting by votes' do
it 'sorts most popular issues' do
get :issues, params: { id: group.to_param, sort: 'upvotes_desc' }
......
......@@ -52,9 +52,5 @@ FactoryBot.define do
factory :incident do
issue_type { :incident }
end
factory :quality_test_case do
issue_type { :test_case }
end
end
end
......@@ -141,7 +141,6 @@ RSpec.describe Issue do
describe '.with_issue_type' do
let_it_be(:issue) { create(:issue, project: reusable_project) }
let_it_be(:incident) { create(:incident, project: reusable_project) }
let_it_be(:test_case) { create(:quality_test_case, project: reusable_project) }
it 'gives issues with the given issue type' do
expect(described_class.with_issue_type('issue'))
......@@ -149,8 +148,8 @@ RSpec.describe Issue do
end
it 'gives issues with the given issue type' do
expect(described_class.with_issue_type(%w(issue incident test_case)))
.to contain_exactly(issue, incident, test_case)
expect(described_class.with_issue_type(%w(issue incident)))
.to contain_exactly(issue, incident)
end
end
......
......@@ -10,14 +10,6 @@ RSpec.describe Projects::OpenIssuesCountService, :use_clean_rails_memory_store_c
it_behaves_like 'a counter caching service'
describe '#count' do
it 'does not count test cases' do
create(:issue, :opened, project: project)
create(:incident, :opened, project: project)
create(:quality_test_case, :opened, project: project)
expect(described_class.new(project).count).to eq(2)
end
context 'when user is nil' do
it 'does not include confidential issues in the issue count' do
create(:issue, :opened, project: project)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment