Class: GraphqlRails::RSpecControllerHelpers::SingleControllerSchemaBuilder
- Inherits:
-
Object
- Object
- GraphqlRails::RSpecControllerHelpers::SingleControllerSchemaBuilder
- Defined in:
- lib/graphql_rails/rspec_controller_helpers.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(controller) ⇒ SingleControllerSchemaBuilder
constructor
A new instance of SingleControllerSchemaBuilder.
Constructor Details
#initialize(controller) ⇒ SingleControllerSchemaBuilder
Returns a new instance of SingleControllerSchemaBuilder.
84 85 86 |
# File 'lib/graphql_rails/rspec_controller_helpers.rb', line 84 def initialize(controller) @controller = controller end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
82 83 84 |
# File 'lib/graphql_rails/rspec_controller_helpers.rb', line 82 def controller @controller end |
Instance Method Details
#call ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/graphql_rails/rspec_controller_helpers.rb', line 88 def call config = controller.controller_configuration action_by_name = config.action_by_name controller_path = controller.name.underscore.sub(/_controller\Z/, '') router = Router.draw do action_by_name.keys.each do |action_name| query("#{action_name}_test", to: "#{controller_path}##{action_name}", group: :graphql_rspec_helpers) end end router.graphql_schema(:graphql_rspec_helpers) end |