summaryrefslogtreecommitdiff
path: root/spec/support/api
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-08-01 15:41:30 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-08-17 12:58:58 -0300
commite1998844781b92d118f25cb8f8c0cbd293a25708 (patch)
tree006c9df0983d5d3534a522cdbfa303b1c4926f48 /spec/support/api
parentbddb2f938cea11f31dc78f0c7bf9bb203ee3a4bd (diff)
downloadgitlab-ce-e1998844781b92d118f25cb8f8c0cbd293a25708.tar.gz
Projects::BoardsController#show returns a list of board lists
Diffstat (limited to 'spec/support/api')
-rw-r--r--spec/support/api/schema_matcher.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/support/api/schema_matcher.rb b/spec/support/api/schema_matcher.rb
new file mode 100644
index 00000000000..929b637e5eb
--- /dev/null
+++ b/spec/support/api/schema_matcher.rb
@@ -0,0 +1,9 @@
+RSpec::Matchers.define :match_response_schema do |schema, options = {}|
+ match do |response|
+ schema_directory = "#{Dir.pwd}/spec/fixtures/api/schemas"
+ schema_path = "#{schema_directory}/#{schema}.json"
+ list = options.fetch(:array, false)
+
+ JSON::Validator.validate!(schema_path, response.body, list: list)
+ end
+end