summaryrefslogtreecommitdiff
path: root/spec/frontend/fixtures/api_markdown.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/fixtures/api_markdown.rb')
-rw-r--r--spec/frontend/fixtures/api_markdown.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/frontend/fixtures/api_markdown.rb b/spec/frontend/fixtures/api_markdown.rb
new file mode 100644
index 00000000000..e012d922aad
--- /dev/null
+++ b/spec/frontend/fixtures/api_markdown.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe API::MergeRequests, '(JavaScript fixtures)', type: :request do
+ include ApiHelpers
+ include JavaScriptFixturesHelpers
+
+ fixture_subdir = 'api/markdown'
+
+ before(:all) do
+ clean_frontend_fixtures(fixture_subdir)
+ end
+
+ markdown_examples = begin
+ yaml_file_path = File.expand_path('api_markdown.yml', __dir__)
+ yaml = File.read(yaml_file_path)
+ YAML.safe_load(yaml, symbolize_names: true)
+ end
+
+ markdown_examples.each do |markdown_example|
+ name = markdown_example.fetch(:name)
+
+ context "for #{name}" do
+ let(:markdown) { markdown_example.fetch(:markdown) }
+
+ it "#{fixture_subdir}/#{name}.json" do
+ post api("/markdown"), params: { text: markdown }
+
+ expect(response).to be_successful
+ end
+ end
+ end
+end