Skip to content

Commit

Permalink
Enable toggling of GraphQL with query string
Browse files Browse the repository at this point in the history
This will be used during load testing to allow us to make GraphQL
queries without needing to update the environment variable.
  • Loading branch information
brucebolt committed Nov 18, 2024
1 parent 7eea2a7 commit 2153816
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/world_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class WorldController < ApplicationController
def index
if Features.graphql_feature_enabled?
if Features.graphql_feature_enabled? || params.include?(:graphql)
index = WorldIndexGraphql.find!("/world")
@presented_index = WorldIndexGraphqlPresenter.new(index)
else
Expand Down
12 changes: 12 additions & 0 deletions spec/features/world_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,16 @@

it_behaves_like "world index page"
end

context "with the GraphQL query string" do
before do
stub_publishing_api_graphql_query(
Graphql::WorldIndexQuery.new("/world").query,
fetch_graphql_fixture("world_index"),
)
visit "/world?graphql=true"
end

it_behaves_like "world index page"
end
end

0 comments on commit 2153816

Please sign in to comment.