Commit 7a26cf1d authored by Lin Jen-Shin's avatar Lin Jen-Shin

Move spec files

parent e8af6817
require 'spec_helper'
require_relative '../../email_shared_blocks'
require Rails.root.join('spec/lib/gitlab/email/email_shared_blocks')
describe Gitlab::Email::Handler::EE::ServiceDeskHandler do
include_context :email_shared_context
......
......@@ -36,7 +36,7 @@ describe API::Issues do # rubocop:disable RSpec/FilePath
get api('/issues', user)
expect(response).to have_http_status(200)
expect(response).to match_response_schema('public_api/v4/ee/issues')
expect(response).to match_response_schema('public_api/v4/issues', dir: 'ee')
end
end
end
......
......@@ -29,6 +29,9 @@ end
# require rainbow gem String monkeypatch, so we can test SystemChecks
require 'rainbow/ext/string'
# EE specific support
Dir[Rails.root.join("spec/ee/support/**/*.rb")].each { |f| require f }
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
......
......@@ -229,7 +229,7 @@ shared_examples_for 'group and project milestones' do |route_definition|
get api(issues_route, user)
expect(response).to have_http_status(200)
expect(response).to match_response_schema('public_api/v4/ee/issues')
expect(response).to match_response_schema('public_api/v4/issues', dir: 'ee')
end
it 'returns a 401 error if user not authenticated' do
......
def schema_path(schema)
schema_directory = "#{Dir.pwd}/spec/fixtures/api/schemas"
"#{schema_directory}/#{schema}.json"
module SchemaPath
def self.expand(schema, dir = '')
Rails.root.join('spec', dir, "fixtures/api/schemas/#{schema}.json").to_s
end
end
RSpec::Matchers.define :match_response_schema do |schema, **options|
RSpec::Matchers.define :match_response_schema do |schema, dir: '', **options|
match do |response|
JSON::Validator.validate!(schema_path(schema), response.body, options)
JSON::Validator.validate!(SchemaPath.expand(schema, dir), response.body, options)
end
end
RSpec::Matchers.define :match_schema do |schema, **options|
RSpec::Matchers.define :match_schema do |schema, dir: '', **options|
match do |data|
JSON::Validator.validate!(schema_path(schema), data, options)
JSON::Validator.validate!(SchemaPath.expand(schema, dir), data, options)
end
end
require_relative 'ee/ldap_helpers'
module LdapHelpers
include EE::LdapHelpers
......
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