• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

graphql-devise / graphql_devise / 4b9f7e61-28b8-4aad-8b1d-cc56262cabcf

27 Nov 2024 08:26AM UTC coverage: 97.417% (-0.006%) from 97.423%
4b9f7e61-28b8-4aad-8b1d-cc56262cabcf

push

circleci

web-flow
Merge pull request #278 from graphql-devise/add-rails-7-2-support

Add support for Rails 7.2

1 of 1 new or added line in 1 file covered. (100.0%)

1 existing line in 1 file now uncovered.

792 of 813 relevant lines covered (97.42%)

1521.21 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.24
/lib/graphql_devise/concerns/auth_controller_methods.rb
1
# frozen_string_literal: true
2

3
module GraphqlDevise
57✔
4
  module AuthControllerMethods
57✔
5
    extend ActiveSupport::Concern
57✔
6

7
    def auth
57✔
8
      result = if params[:_json]
2,451✔
9
        Schema.multiplex(
57✔
10
          params[:_json].map do |param|
11
            { query: param[:query] }.merge(execute_params(param))
114✔
12
          end
13
        )
14
      else
15
        Schema.execute(params[:query], **execute_params(params))
2,394✔
16
      end
17

18
      render json: result unless performed?
2,451✔
19
    end
20

21
    attr_accessor :client_id, :token, :resource
57✔
22

23
    private
57✔
24

25
    def execute_params(item)
57✔
26
      {
27
        operation_name: item[:operationName],
2,508✔
28
        variables:      ensure_hash(item[:variables]),
29
        context:        { controller: self }
30
      }
31
    end
32

33
    def ensure_hash(ambiguous_param)
57✔
34
      case ambiguous_param
2,565✔
35
      when String
36
        if ambiguous_param.present?
114✔
37
          ensure_hash(JSON.parse(ambiguous_param))
57✔
38
        else
39
          {}
57✔
40
        end
41
      when Hash, ActionController::Parameters
42
        ambiguous_param
57✔
43
      when nil
44
        {}
2,394✔
45
      else
UNCOV
46
        raise ArgumentError, "Unexpected parameter: #{ambiguous_param}"
×
47
      end
48
    end
49
  end
50
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc