diff options
Diffstat (limited to 'spec/frontend/fixtures')
-rw-r--r-- | spec/frontend/fixtures/application_settings.rb | 1 | ||||
-rw-r--r-- | spec/frontend/fixtures/blob.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/branches.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/clusters.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/commit.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/freeze_period.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/issues.rb | 11 | ||||
-rw-r--r-- | spec/frontend/fixtures/jobs.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/listbox.rb | 31 | ||||
-rw-r--r-- | spec/frontend/fixtures/merge_requests.rb | 13 | ||||
-rw-r--r-- | spec/frontend/fixtures/merge_requests_diffs.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/pipeline_schedules.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/projects.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/prometheus_service.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/runner.rb | 44 | ||||
-rw-r--r-- | spec/frontend/fixtures/services.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/snippet.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/tags.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/todos.rb | 2 |
19 files changed, 101 insertions, 27 deletions
diff --git a/spec/frontend/fixtures/application_settings.rb b/spec/frontend/fixtures/application_settings.rb index 9fa8d68e695..a7a989f31ec 100644 --- a/spec/frontend/fixtures/application_settings.rb +++ b/spec/frontend/fixtures/application_settings.rb @@ -13,6 +13,7 @@ RSpec.describe Admin::ApplicationSettingsController, '(JavaScript fixtures)', ty before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') + allow(Gitlab::Metrics).to receive(:metrics_folder_present?).and_return(true) sign_in(admin) enable_admin_mode!(admin) end diff --git a/spec/frontend/fixtures/blob.rb b/spec/frontend/fixtures/blob.rb index 35a7ff4eb07..af548823886 100644 --- a/spec/frontend/fixtures/blob.rb +++ b/spec/frontend/fixtures/blob.rb @@ -7,7 +7,7 @@ RSpec.describe Projects::BlobController, '(JavaScript fixtures)', type: :control let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'branches-project') } - let(:user) { project.owner } + let(:user) { project.first_owner } render_views diff --git a/spec/frontend/fixtures/branches.rb b/spec/frontend/fixtures/branches.rb index 828564977e0..b3bb4b8873a 100644 --- a/spec/frontend/fixtures/branches.rb +++ b/spec/frontend/fixtures/branches.rb @@ -7,7 +7,7 @@ RSpec.describe 'Branches (JavaScript fixtures)' do let_it_be(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let_it_be(:project) { create(:project, :repository, namespace: namespace, path: 'branches-project') } - let_it_be(:user) { project.owner } + let_it_be(:user) { project.first_owner } after(:all) do remove_repository(project) diff --git a/spec/frontend/fixtures/clusters.rb b/spec/frontend/fixtures/clusters.rb index ea883555255..49596d98774 100644 --- a/spec/frontend/fixtures/clusters.rb +++ b/spec/frontend/fixtures/clusters.rb @@ -8,7 +8,7 @@ RSpec.describe Projects::ClustersController, '(JavaScript fixtures)', type: :con let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace) } let(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } - let(:user) { project.owner } + let(:user) { project.first_owner } render_views diff --git a/spec/frontend/fixtures/commit.rb b/spec/frontend/fixtures/commit.rb index f9e0f604b52..815c140950d 100644 --- a/spec/frontend/fixtures/commit.rb +++ b/spec/frontend/fixtures/commit.rb @@ -6,7 +6,7 @@ RSpec.describe 'Commit (JavaScript fixtures)' do include JavaScriptFixturesHelpers let_it_be(:project) { create(:project, :repository) } - let_it_be(:user) { project.owner } + let_it_be(:user) { project.first_owner } let_it_be(:commit) { project.commit("master") } before do diff --git a/spec/frontend/fixtures/freeze_period.rb b/spec/frontend/fixtures/freeze_period.rb index d9573c8000d..dd16bd81b51 100644 --- a/spec/frontend/fixtures/freeze_period.rb +++ b/spec/frontend/fixtures/freeze_period.rb @@ -7,7 +7,7 @@ RSpec.describe 'Freeze Periods (JavaScript fixtures)' do include TimeZoneHelper let_it_be(:project) { create(:project, :repository, path: 'freeze-periods-project') } - let_it_be(:user) { project.owner } + let_it_be(:user) { project.first_owner } after(:all) do remove_repository(project) diff --git a/spec/frontend/fixtures/issues.rb b/spec/frontend/fixtures/issues.rb index 6519416cb9e..8bedb802242 100644 --- a/spec/frontend/fixtures/issues.rb +++ b/spec/frontend/fixtures/issues.rb @@ -37,17 +37,6 @@ RSpec.describe Projects::IssuesController, '(JavaScript fixtures)', type: :contr render_issue(create(:closed_issue, project: project)) end - it 'issues/issue_list.html' do - create(:issue, project: project) - - get :index, params: { - namespace_id: project.namespace.to_param, - project_id: project - } - - expect(response).to be_successful - end - private def render_issue(issue) diff --git a/spec/frontend/fixtures/jobs.rb b/spec/frontend/fixtures/jobs.rb index 12584f38629..3cc87432655 100644 --- a/spec/frontend/fixtures/jobs.rb +++ b/spec/frontend/fixtures/jobs.rb @@ -7,7 +7,7 @@ RSpec.describe Projects::JobsController, '(JavaScript fixtures)', type: :control let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'builds-project') } - let(:user) { project.owner } + let(:user) { project.first_owner } let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.id) } let!(:build_with_artifacts) { create(:ci_build, :success, :artifacts, :trace_artifact, pipeline: pipeline, stage: 'test', artifacts_expire_at: Time.now + 18.months) } let!(:failed_build) { create(:ci_build, :failed, pipeline: pipeline, stage: 'build') } diff --git a/spec/frontend/fixtures/listbox.rb b/spec/frontend/fixtures/listbox.rb new file mode 100644 index 00000000000..8f8489a2827 --- /dev/null +++ b/spec/frontend/fixtures/listbox.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'initRedirectListboxBehavior', '(JavaScript fixtures)', type: :helper do + include JavaScriptFixturesHelpers + include ListboxHelper + + let(:response) { @tag } + + it 'listbox/redirect_listbox.html' do + items = [{ + value: 'foo', + text: 'Foo', + href: '/foo', + arbitrary_key: 'foo xyz' + }, { + value: 'bar', + text: 'Bar', + href: '/bar', + arbitrary_key: 'bar xyz' + }, { + value: 'qux', + text: 'Qux', + href: '/qux', + arbitrary_key: 'qux xyz' + }] + + @tag = helper.gl_redirect_listbox_tag(items, 'bar', class: %w[test-class-1 test-class-2], data: { right: true }) + end +end diff --git a/spec/frontend/fixtures/merge_requests.rb b/spec/frontend/fixtures/merge_requests.rb index 68ed2ca2359..1eb48c0ce2c 100644 --- a/spec/frontend/fixtures/merge_requests.rb +++ b/spec/frontend/fixtures/merge_requests.rb @@ -7,7 +7,7 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'merge-requests-project') } - let(:user) { project.owner } + let(:user) { project.first_owner } # rubocop: disable Layout/TrailingWhitespace let(:description) do @@ -119,6 +119,17 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: end end + it 'merge_requests/merge_request_list.html' do + create(:merge_request, source_project: project, target_project: project) + + get :index, params: { + namespace_id: project.namespace.to_param, + project_id: project + } + + expect(response).to be_successful + end + private def render_discussions_json(merge_request) diff --git a/spec/frontend/fixtures/merge_requests_diffs.rb b/spec/frontend/fixtures/merge_requests_diffs.rb index e733764f248..7f0d650b710 100644 --- a/spec/frontend/fixtures/merge_requests_diffs.rb +++ b/spec/frontend/fixtures/merge_requests_diffs.rb @@ -7,7 +7,7 @@ RSpec.describe Projects::MergeRequests::DiffsController, '(JavaScript fixtures)' let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'merge-requests-project') } - let(:user) { project.owner } + let(:user) { project.first_owner } let(:merge_request) { create(:merge_request, source_project: project, target_project: project, description: '- [ ] Task List Item') } let(:path) { "files/ruby/popen.rb" } let(:position) do diff --git a/spec/frontend/fixtures/pipeline_schedules.rb b/spec/frontend/fixtures/pipeline_schedules.rb index 6389f59aa0a..e155d27920d 100644 --- a/spec/frontend/fixtures/pipeline_schedules.rb +++ b/spec/frontend/fixtures/pipeline_schedules.rb @@ -7,7 +7,7 @@ RSpec.describe Projects::PipelineSchedulesController, '(JavaScript fixtures)', t let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :public, :repository) } - let(:user) { project.owner } + let(:user) { project.first_owner } let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: user) } let!(:pipeline_schedule_populated) { create(:ci_pipeline_schedule, project: project, owner: user) } let!(:pipeline_schedule_variable1) { create(:ci_pipeline_schedule_variable, key: 'foo', value: 'foovalue', pipeline_schedule: pipeline_schedule_populated) } diff --git a/spec/frontend/fixtures/projects.rb b/spec/frontend/fixtures/projects.rb index 3c8964d398a..fa7d61df3e8 100644 --- a/spec/frontend/fixtures/projects.rb +++ b/spec/frontend/fixtures/projects.rb @@ -12,7 +12,7 @@ RSpec.describe 'Projects (JavaScript fixtures)', type: :controller do let(:project) { create(:project, namespace: namespace, path: 'builds-project', runners_token: runners_token, avatar: fixture_file_upload('spec/fixtures/dk.png', 'image/png')) } let(:project_with_repo) { create(:project, :repository, description: 'Code and stuff', avatar: fixture_file_upload('spec/fixtures/dk.png', 'image/png')) } let(:project_variable_populated) { create(:project, namespace: namespace, path: 'builds-project2', runners_token: runners_token) } - let(:user) { project.owner } + let(:user) { project.first_owner } render_views diff --git a/spec/frontend/fixtures/prometheus_service.rb b/spec/frontend/fixtures/prometheus_service.rb index bbd938c66f6..aed73dc1096 100644 --- a/spec/frontend/fixtures/prometheus_service.rb +++ b/spec/frontend/fixtures/prometheus_service.rb @@ -8,7 +8,7 @@ RSpec.describe Projects::ServicesController, '(JavaScript fixtures)', type: :con let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project_empty_repo, namespace: namespace, path: 'services-project') } let!(:integration) { create(:prometheus_integration, project: project) } - let(:user) { project.owner } + let(:user) { project.first_owner } render_views diff --git a/spec/frontend/fixtures/runner.rb b/spec/frontend/fixtures/runner.rb index 36e6cf72750..cdb4c3fd8ba 100644 --- a/spec/frontend/fixtures/runner.rb +++ b/spec/frontend/fixtures/runner.rb @@ -11,11 +11,13 @@ RSpec.describe 'Runner (JavaScript fixtures)' do let_it_be(:admin) { create(:admin) } let_it_be(:group) { create(:group) } let_it_be(:project) { create(:project, :repository, :public) } + let_it_be(:project_2) { create(:project, :repository, :public) } let_it_be(:instance_runner) { create(:ci_runner, :instance, version: '1.0.0', revision: '123', description: 'Instance runner', ip_address: '127.0.0.1') } let_it_be(:group_runner) { create(:ci_runner, :group, groups: [group], active: false, version: '2.0.0', revision: '456', description: 'Group runner', ip_address: '127.0.0.1') } let_it_be(:group_runner_2) { create(:ci_runner, :group, groups: [group], active: false, version: '2.0.0', revision: '456', description: 'Group runner 2', ip_address: '127.0.0.1') } - let_it_be(:project_runner) { create(:ci_runner, :project, projects: [project], active: false, version: '2.0.0', revision: '456', description: 'Project runner', ip_address: '127.0.0.1') } + let_it_be(:project_runner) { create(:ci_runner, :project, projects: [project, project_2], active: false, version: '2.0.0', revision: '456', description: 'Project runner', ip_address: '127.0.0.1') } + let_it_be(:build) { create(:ci_build, runner: instance_runner) } query_path = 'runner/graphql/' fixtures_path = 'graphql/runner/' @@ -78,6 +80,46 @@ RSpec.describe 'Runner (JavaScript fixtures)' do expect_graphql_errors_to_be_empty end + + it "#{fixtures_path}#{get_runner_query_name}.with_group.json" do + post_graphql(query, current_user: admin, variables: { + id: group_runner.to_global_id.to_s + }) + + expect_graphql_errors_to_be_empty + end + end + + describe GraphQL::Query, type: :request do + get_runner_projects_query_name = 'get_runner_projects.query.graphql' + + let_it_be(:query) do + get_graphql_query_as_string("#{query_path}#{get_runner_projects_query_name}") + end + + it "#{fixtures_path}#{get_runner_projects_query_name}.json" do + post_graphql(query, current_user: admin, variables: { + id: project_runner.to_global_id.to_s + }) + + expect_graphql_errors_to_be_empty + end + end + + describe GraphQL::Query, type: :request do + get_runner_jobs_query_name = 'get_runner_jobs.query.graphql' + + let_it_be(:query) do + get_graphql_query_as_string("#{query_path}#{get_runner_jobs_query_name}") + end + + it "#{fixtures_path}#{get_runner_jobs_query_name}.json" do + post_graphql(query, current_user: admin, variables: { + id: instance_runner.to_global_id.to_s + }) + + expect_graphql_errors_to_be_empty + end end end diff --git a/spec/frontend/fixtures/services.rb b/spec/frontend/fixtures/services.rb index a8293a080a9..f0bb8fb962f 100644 --- a/spec/frontend/fixtures/services.rb +++ b/spec/frontend/fixtures/services.rb @@ -8,7 +8,7 @@ RSpec.describe Projects::ServicesController, '(JavaScript fixtures)', type: :con let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project_empty_repo, namespace: namespace, path: 'services-project') } let!(:service) { create(:custom_issue_tracker_integration, project: project) } - let(:user) { project.owner } + let(:user) { project.first_owner } render_views diff --git a/spec/frontend/fixtures/snippet.rb b/spec/frontend/fixtures/snippet.rb index 397fb3e7124..f05ff3ee269 100644 --- a/spec/frontend/fixtures/snippet.rb +++ b/spec/frontend/fixtures/snippet.rb @@ -7,7 +7,7 @@ RSpec.describe SnippetsController, '(JavaScript fixtures)', type: :controller do let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'branches-project') } - let(:user) { project.owner } + let(:user) { project.first_owner } let(:snippet) { create(:personal_snippet, :public, title: 'snippet.md', content: '# snippet', file_name: 'snippet.md', author: user) } render_views diff --git a/spec/frontend/fixtures/tags.rb b/spec/frontend/fixtures/tags.rb index 6cfa5f82efe..fdf85844ee2 100644 --- a/spec/frontend/fixtures/tags.rb +++ b/spec/frontend/fixtures/tags.rb @@ -6,7 +6,7 @@ RSpec.describe 'Tags (JavaScript fixtures)' do include JavaScriptFixturesHelpers let_it_be(:project) { create(:project, :repository, path: 'tags-project') } - let_it_be(:user) { project.owner } + let_it_be(:user) { project.first_owner } after(:all) do remove_repository(project) diff --git a/spec/frontend/fixtures/todos.rb b/spec/frontend/fixtures/todos.rb index a0573b0b658..7dce09e8f49 100644 --- a/spec/frontend/fixtures/todos.rb +++ b/spec/frontend/fixtures/todos.rb @@ -7,7 +7,7 @@ RSpec.describe 'Todos (JavaScript fixtures)' do let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project_empty_repo, namespace: namespace, path: 'todos-project') } - let(:user) { project.owner } + let(:user) { project.first_owner } let(:issue_1) { create(:issue, title: 'issue_1', project: project) } let!(:todo_1) { create(:todo, user: user, project: project, target: issue_1, created_at: 5.hours.ago) } let(:issue_2) { create(:issue, title: 'issue_2', project: project) } |