diff options
Diffstat (limited to 'spec/support/matchers/schema_matcher.rb')
-rw-r--r-- | spec/support/matchers/schema_matcher.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/support/matchers/schema_matcher.rb b/spec/support/matchers/schema_matcher.rb index ebbd57c8115..f0e7a52c51e 100644 --- a/spec/support/matchers/schema_matcher.rb +++ b/spec/support/matchers/schema_matcher.rb @@ -2,6 +2,8 @@ module SchemaPath def self.expand(schema, dir = nil) + return schema unless schema.is_a?(String) + if Gitlab.ee? && dir.nil? ee_path = expand(schema, 'ee') @@ -35,7 +37,13 @@ RSpec::Matchers.define :match_schema do |schema, dir: nil, **options| end failure_message do |response| - "didn't match the schema defined by #{SchemaPath.expand(schema, dir)}" \ + "didn't match the schema defined by #{schema_name(schema, dir)}" \ " The validation errors were:\n#{@errors.join("\n")}" end + + def schema_name(schema, dir) + return 'provided schema' unless schema.is_a?(String) + + SchemaPath.expand(schema, dir) + end end |