diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /spec/support/helpers/javascript_fixtures_helpers.rb | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'spec/support/helpers/javascript_fixtures_helpers.rb')
-rw-r--r-- | spec/support/helpers/javascript_fixtures_helpers.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/spec/support/helpers/javascript_fixtures_helpers.rb b/spec/support/helpers/javascript_fixtures_helpers.rb index 8fd8a548011..4c90b907d2d 100644 --- a/spec/support/helpers/javascript_fixtures_helpers.rb +++ b/spec/support/helpers/javascript_fixtures_helpers.rb @@ -43,12 +43,14 @@ 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` - # fragment_paths - an optional array of file paths to any fragments the query uses, - # also relative to `app/assets/javascripts` - def get_graphql_query_as_string(query_path, fragment_paths = []) - [query_path, *fragment_paths].map do |path| - File.read(File.join(Rails.root, '/app/assets/javascripts', path)) - end.join("\n") + def get_graphql_query_as_string(query_path) + path = Rails.root / 'app/assets/javascripts' / query_path + queries = Gitlab::Graphql::Queries.find(path) + if queries.length == 1 + queries.first.text(mode: Gitlab.ee? ? :ee : :ce ) + else + raise "Could not find query file at #{path}, please check your query_path" % path + end end private |