diff options
Diffstat (limited to 'spec/frontend/fixtures')
-rw-r--r-- | spec/frontend/fixtures/api_markdown.rb | 34 | ||||
-rw-r--r-- | spec/frontend/fixtures/api_markdown.yml | 33 | ||||
-rw-r--r-- | spec/frontend/fixtures/application_settings.rb | 8 | ||||
-rw-r--r-- | spec/frontend/fixtures/pipelines.rb | 1 | ||||
-rw-r--r-- | spec/frontend/fixtures/projects.rb | 3 | ||||
-rw-r--r-- | spec/frontend/fixtures/prometheus_service.rb | 4 | ||||
-rw-r--r-- | spec/frontend/fixtures/releases.rb | 8 | ||||
-rw-r--r-- | spec/frontend/fixtures/runner.rb | 9 |
8 files changed, 82 insertions, 18 deletions
diff --git a/spec/frontend/fixtures/api_markdown.rb b/spec/frontend/fixtures/api_markdown.rb index 1c3967b2c36..94db262e4fd 100644 --- a/spec/frontend/fixtures/api_markdown.rb +++ b/spec/frontend/fixtures/api_markdown.rb @@ -4,12 +4,29 @@ require 'spec_helper' RSpec.describe API::MergeRequests, '(JavaScript fixtures)', type: :request do include ApiHelpers + include WikiHelpers include JavaScriptFixturesHelpers + let_it_be(:user) { create(:user) } + + let_it_be(:group) { create(:group, :public) } + let_it_be(:project) { create(:project, :public, :repository, group: group) } + + let_it_be(:project_wiki) { create(:project_wiki, user: user) } + + let(:project_wiki_page) { create(:wiki_page, wiki: project_wiki) } + fixture_subdir = 'api/markdown' before(:all) do clean_frontend_fixtures(fixture_subdir) + + group.add_owner(user) + project.add_maintainer(user) + end + + before do + sign_in(user) end markdown_examples = begin @@ -19,14 +36,27 @@ RSpec.describe API::MergeRequests, '(JavaScript fixtures)', type: :request do end markdown_examples.each do |markdown_example| + context = markdown_example.fetch(:context, '') name = markdown_example.fetch(:name) - context "for #{name}" do + context "for #{name}#{!context.empty? ? " (context: #{context})" : ''}" do let(:markdown) { markdown_example.fetch(:markdown) } + name = "#{context}_#{name}" unless context.empty? + it "#{fixture_subdir}/#{name}.json" do - post api("/markdown"), params: { text: markdown, gfm: true } + api_url = case context + when 'project' + "/#{project.full_path}/preview_markdown" + when 'group' + "/groups/#{group.full_path}/preview_markdown" + when 'project_wiki' + "/#{project.full_path}/-/wikis/#{project_wiki_page.slug}/preview_markdown" + else + api "/markdown" + end + post api_url, params: { text: markdown, gfm: true } expect(response).to be_successful end end diff --git a/spec/frontend/fixtures/api_markdown.yml b/spec/frontend/fixtures/api_markdown.yml index 3274e914f03..8d8c9a1d902 100644 --- a/spec/frontend/fixtures/api_markdown.yml +++ b/spec/frontend/fixtures/api_markdown.yml @@ -10,8 +10,28 @@ markdown: '`code`' - name: strike markdown: '~~del~~' +- name: horizontal_rule + markdown: '---' - name: link markdown: '[GitLab](https://gitlab.com)' +- name: attachment_link + context: project_wiki + markdown: '[test-file](test-file.zip)' +- name: attachment_link + context: project + markdown: '[test-file](/uploads/aa45a38ec2cfe97433281b10bbff042c/test-file.zip)' +- name: attachment_link + context: group + markdown: '[test-file](/uploads/aa45a38ec2cfe97433281b10bbff042c/test-file.zip)' +- name: attachment_image + context: project_wiki + markdown: '![test-file](test-file.png)' +- name: attachment_image + context: project + markdown: '![test-file](/uploads/aa45a38ec2cfe97433281b10bbff042c/test-file.png)' +- name: attachment_image + context: group + markdown: '![test-file](/uploads/aa45a38ec2cfe97433281b10bbff042c/test-file.png)' - name: code_block markdown: |- ```javascript @@ -54,3 +74,16 @@ markdown: |- This is a line after a\ hard break +- name: table + markdown: |- + | header | header | + |--------|--------| + | cell | cell | + | cell | cell | +- name: table_with_alignment + markdown: |- + | header | : header : | header : | + |--------|------------|----------| + | cell | cell | cell | + | cell | cell | cell | + diff --git a/spec/frontend/fixtures/application_settings.rb b/spec/frontend/fixtures/application_settings.rb index ebccecb32ba..b09bea56b94 100644 --- a/spec/frontend/fixtures/application_settings.rb +++ b/spec/frontend/fixtures/application_settings.rb @@ -34,4 +34,12 @@ RSpec.describe Admin::ApplicationSettingsController, '(JavaScript fixtures)', ty expect(response).to be_successful end + + it 'application_settings/usage.html' do + stub_application_setting(usage_ping_enabled: false) + + get :metrics_and_profiling + + expect(response).to be_successful + end end diff --git a/spec/frontend/fixtures/pipelines.rb b/spec/frontend/fixtures/pipelines.rb index 2a538352abe..f695b74ec87 100644 --- a/spec/frontend/fixtures/pipelines.rb +++ b/spec/frontend/fixtures/pipelines.rb @@ -13,6 +13,7 @@ RSpec.describe Projects::PipelinesController, '(JavaScript fixtures)', type: :co let!(:build_pipeline_without_author) { create(:ci_build, pipeline: pipeline_without_author, stage: 'test') } let_it_be(:pipeline_without_commit) { create(:ci_pipeline, status: :success, project: project, sha: '0000') } + let!(:build_pipeline_without_commit) { create(:ci_build, pipeline: pipeline_without_commit, stage: 'test') } let(:commit) { create(:commit, project: project) } diff --git a/spec/frontend/fixtures/projects.rb b/spec/frontend/fixtures/projects.rb index 778ae218160..7873d59dbad 100644 --- a/spec/frontend/fixtures/projects.rb +++ b/spec/frontend/fixtures/projects.rb @@ -61,13 +61,12 @@ RSpec.describe 'Projects (JavaScript fixtures)', type: :controller do clean_frontend_fixtures('graphql/projects/access_tokens') end - fragment_paths = ['graphql_shared/fragments/pageInfo.fragment.graphql'] base_input_path = 'access_tokens/graphql/queries/' base_output_path = 'graphql/projects/access_tokens/' query_name = 'get_projects.query.graphql' it "#{base_output_path}#{query_name}.json" do - query = get_graphql_query_as_string("#{base_input_path}#{query_name}", fragment_paths) + query = get_graphql_query_as_string("#{base_input_path}#{query_name}") post_graphql(query, current_user: user, variables: { search: '', first: 2 }) diff --git a/spec/frontend/fixtures/prometheus_service.rb b/spec/frontend/fixtures/prometheus_service.rb index 3a59ecf3868..c349f2a24bc 100644 --- a/spec/frontend/fixtures/prometheus_service.rb +++ b/spec/frontend/fixtures/prometheus_service.rb @@ -7,7 +7,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(:prometheus_service, project: project) } + let!(:integration) { create(:prometheus_integration, project: project) } let(:user) { project.owner } render_views @@ -28,7 +28,7 @@ RSpec.describe Projects::ServicesController, '(JavaScript fixtures)', type: :con get :edit, params: { namespace_id: namespace, project_id: project, - id: service.to_param + id: integration.to_param } expect(response).to be_successful diff --git a/spec/frontend/fixtures/releases.rb b/spec/frontend/fixtures/releases.rb index ac34400bc01..e8f259fba15 100644 --- a/spec/frontend/fixtures/releases.rb +++ b/spec/frontend/fixtures/releases.rb @@ -133,15 +133,13 @@ RSpec.describe 'Releases (JavaScript fixtures)' do all_releases_query_path = 'releases/graphql/queries/all_releases.query.graphql' one_release_query_path = 'releases/graphql/queries/one_release.query.graphql' one_release_for_editing_query_path = 'releases/graphql/queries/one_release_for_editing.query.graphql' - release_fragment_path = 'releases/graphql/fragments/release.fragment.graphql' - release_for_editing_fragment_path = 'releases/graphql/fragments/release_for_editing.fragment.graphql' before(:all) do clean_frontend_fixtures('graphql/releases/') end it "graphql/#{all_releases_query_path}.json" do - query = get_graphql_query_as_string(all_releases_query_path, [release_fragment_path]) + query = get_graphql_query_as_string(all_releases_query_path) post_graphql(query, current_user: admin, variables: { fullPath: project.full_path }) @@ -150,7 +148,7 @@ RSpec.describe 'Releases (JavaScript fixtures)' do end it "graphql/#{one_release_query_path}.json" do - query = get_graphql_query_as_string(one_release_query_path, [release_fragment_path]) + query = get_graphql_query_as_string(one_release_query_path) post_graphql(query, current_user: admin, variables: { fullPath: project.full_path, tagName: release.tag }) @@ -159,7 +157,7 @@ RSpec.describe 'Releases (JavaScript fixtures)' do end it "graphql/#{one_release_for_editing_query_path}.json" do - query = get_graphql_query_as_string(one_release_for_editing_query_path, [release_for_editing_fragment_path]) + query = get_graphql_query_as_string(one_release_for_editing_query_path) post_graphql(query, current_user: admin, variables: { fullPath: project.full_path, tagName: release.tag }) diff --git a/spec/frontend/fixtures/runner.rb b/spec/frontend/fixtures/runner.rb index b88fb840137..e29a58f43b9 100644 --- a/spec/frontend/fixtures/runner.rb +++ b/spec/frontend/fixtures/runner.rb @@ -36,10 +36,7 @@ RSpec.describe 'Runner (JavaScript fixtures)' do get_runners_query_name = 'get_runners.query.graphql' let_it_be(:query) do - get_graphql_query_as_string("#{query_path}#{get_runners_query_name}", [ - 'runner/graphql/runner_node.fragment.graphql', - 'graphql_shared/fragments/pageInfo.fragment.graphql' - ]) + get_graphql_query_as_string("#{query_path}#{get_runners_query_name}") end it "#{fixtures_path}#{get_runners_query_name}.json" do @@ -59,9 +56,7 @@ RSpec.describe 'Runner (JavaScript fixtures)' do get_runner_query_name = 'get_runner.query.graphql' let_it_be(:query) do - get_graphql_query_as_string("#{query_path}#{get_runner_query_name}", [ - 'runner/graphql/runner_details.fragment.graphql' - ]) + get_graphql_query_as_string("#{query_path}#{get_runner_query_name}") end it "#{fixtures_path}#{get_runner_query_name}.json" do |