summaryrefslogtreecommitdiff
path: root/spec/support/helpers/javascript_fixtures_helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/helpers/javascript_fixtures_helpers.rb')
-rw-r--r--spec/support/helpers/javascript_fixtures_helpers.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/spec/support/helpers/javascript_fixtures_helpers.rb b/spec/support/helpers/javascript_fixtures_helpers.rb
index 4c90b907d2d..5174c145a93 100644
--- a/spec/support/helpers/javascript_fixtures_helpers.rb
+++ b/spec/support/helpers/javascript_fixtures_helpers.rb
@@ -42,9 +42,12 @@ module JavaScriptFixturesHelpers
# Public: Reads a GraphQL query from the filesystem as a string
#
- # query_path - file path to the GraphQL query, relative to `app/assets/javascripts`
- def get_graphql_query_as_string(query_path)
- path = Rails.root / 'app/assets/javascripts' / query_path
+ # query_path - file path to the GraphQL query, relative to `app/assets/javascripts`.
+ # ee - boolean, when true `query_path` will be looked up in `/ee`.
+ def get_graphql_query_as_string(query_path, ee: false)
+ base = (ee ? 'ee/' : '') + 'app/assets/javascripts'
+
+ path = Rails.root / base / query_path
queries = Gitlab::Graphql::Queries.find(path)
if queries.length == 1
queries.first.text(mode: Gitlab.ee? ? :ee : :ce )