Sha256: 68f678eed775982b28c8157b887d6b4706e51e785ead80c2c3497cd89afeacb2
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true require 'test_helper' module GraphQL module Voyager module Rails class ExplorersControllerTest < ActionController::TestCase setup do @routes = GraphQL::Voyager::Rails::Engine.routes end teardown do GraphQL::Voyager::Rails.config.headers = {} end def graphql_params { params: { graphql_path: '/my/endpoint' } } end test 'renders GraphiQL' do get :show, graphql_params assert_response(:success) assert_includes(@response.body, 'my/endpoint', 'it uses the provided path') assert_match(/application-\w+\.js/, @response.body, 'it includes assets') end test 'it renders headers' do GraphQL::Voyager::Rails.config.headers['Nonsense-Header'] = ->(_view_ctx) { 'Value' } get :show, graphql_params assert_includes(@response.body, %(\"Nonsense-Header\":\"Value\")) assert_includes(@response.body, %(\"X-CSRF-Token\")) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems