diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2018-06-18 11:44:55 +0100 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2018-06-18 11:44:55 +0100 |
commit | 67608c7be5b3997231789503fa0bc599cb790f7a (patch) | |
tree | f04ff6c6b42bf35bb058e690c102788237a75fbc /spec/support | |
parent | 1907738f02f42b02fa86a02aa8af747492698d66 (diff) | |
parent | a170c587a0ee2f303908c70a942ef3f163e2ddb7 (diff) | |
download | gitlab-ce-fl-update-registry-code.tar.gz |
[ci skip] Merge branch 'master' into fl-update-registry-codefl-update-registry-code
* master: (68 commits)
Render calendar feed inline when accessed from GitLab
Make Gitaly wiki RPC's mandatory
Remove the ci_job_request_with_tags_matcher
Optimised paused runners to not re-query every 3s
[Rails5] Set request.format for artifacts_controller
[Rails5] Fix sessions_controller_spec
Rails5 update Gemfile.rails5.lock
[Rails5] Fix pipeline_schedules_controller_spec
Fix milestones disappearing when changed on MR
Harmonize theme preferences previews
Resolve "Wiki git clone holder and dropdown is broken"
Resolve "Update link in GitLab cluster setup form to say "see pricing""
Resolve "Misalignment in rows on comparison page"
Resolve "Stop horizontal scrolling when clicking on board issue"
Enable no-multi-assignment in JS files
Fix ci mini graph dropdown alignment and positioning
Remove additional border from the create project page
Fix alert colors
Enable display static for ci job dropdowns so that they dont move when window resizes
Remove pointer events in favor of boundary viewport
...
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/helpers/graphql_helpers.rb | 15 | ||||
-rw-r--r-- | spec/support/matchers/graphql_matchers.rb | 6 |
2 files changed, 18 insertions, 3 deletions
diff --git a/spec/support/helpers/graphql_helpers.rb b/spec/support/helpers/graphql_helpers.rb index 30ff9a1196a..0930b9da368 100644 --- a/spec/support/helpers/graphql_helpers.rb +++ b/spec/support/helpers/graphql_helpers.rb @@ -34,14 +34,20 @@ module GraphqlHelpers end def graphql_query_for(name, attributes = {}, fields = nil) + <<~QUERY + { + #{query_graphql_field(name, attributes, fields)} + } + QUERY + end + + def query_graphql_field(name, attributes = {}, fields = nil) fields ||= all_graphql_fields_for(name.classify) attributes = attributes_to_graphql(attributes) <<~QUERY - { #{name}(#{attributes}) { #{fields} } - } QUERY end @@ -50,12 +56,15 @@ module GraphqlHelpers return "" unless type type.fields.map do |name, field| + # We can't guess arguments, so skip fields that require them + next if field.arguments.any? + if scalar?(field) name else "#{name} { #{all_graphql_fields_for(field_type(field))} }" end - end.join("\n") + end.compact.join("\n") end def attributes_to_graphql(attributes) diff --git a/spec/support/matchers/graphql_matchers.rb b/spec/support/matchers/graphql_matchers.rb index ba7a1c8cde0..d23cbaf4beb 100644 --- a/spec/support/matchers/graphql_matchers.rb +++ b/spec/support/matchers/graphql_matchers.rb @@ -13,6 +13,12 @@ RSpec::Matchers.define :have_graphql_fields do |*expected| end end +RSpec::Matchers.define :have_graphql_field do |field_name| + match do |kls| + expect(kls.fields.keys).to include(GraphqlHelpers.fieldnamerize(field_name)) + end +end + RSpec::Matchers.define :have_graphql_arguments do |*expected| include GraphqlHelpers |