graphql_scaffold_fan 0.2.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 9ee6b47f9da093347123572ffacdd905a85f277c54d2d6fdf99e8dad2a82de6f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8356f034d42ea82fd2c97b7c8d7eb5470ae00f7cb193044d1274357a6db4af22
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 831efd57a1abcdc3f7edf85e864ed12e1bfeecf67d76c108c5af3e3afd1e87d3ebbe93eef5be7b3cf0e6434c8582843237a343b5bab539760059634530f57542
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 25d4dab84c273eeb160bfdcbfa7493af6a3c6d8aee5fdee03a96672a84e398e2e0e428f188784b6a400aae05a4ed158c7da91a252dc0a173fc82324ea2d83773
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            PATH
         
     | 
| 
       2 
2 
     | 
    
         
             
              remote: .
         
     | 
| 
       3 
3 
     | 
    
         
             
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                graphql_scaffold_fan (0. 
     | 
| 
      
 4 
     | 
    
         
            +
                graphql_scaffold_fan (0.3.0)
         
     | 
| 
       5 
5 
     | 
    
         
             
                  graphql
         
     | 
| 
       6 
6 
     | 
    
         
             
                  graphql_playground-rails
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
         @@ -70,7 +70,7 @@ GEM 
     | 
|
| 
       70 
70 
     | 
    
         
             
                builder (3.2.4)
         
     | 
| 
       71 
71 
     | 
    
         
             
                concurrent-ruby (1.1.10)
         
     | 
| 
       72 
72 
     | 
    
         
             
                crass (1.0.6)
         
     | 
| 
       73 
     | 
    
         
            -
                erubi (1. 
     | 
| 
      
 73 
     | 
    
         
            +
                erubi (1.11.0)
         
     | 
| 
       74 
74 
     | 
    
         
             
                globalid (1.0.0)
         
     | 
| 
       75 
75 
     | 
    
         
             
                  activesupport (>= 5.0)
         
     | 
| 
       76 
76 
     | 
    
         
             
                graphql (2.0.12)
         
     | 
| 
         @@ -71,8 +71,10 @@ module GraphqlScaffold 
     | 
|
| 
       71 
71 
     | 
    
         
             
                  def create_test_file
         
     | 
| 
       72 
72 
     | 
    
         
             
                    test_dir_path = 'spec/requests/queries/admin'
         
     | 
| 
       73 
73 
     | 
    
         
             
                    test_file_path = test_dir_path + "/#{file_name}_spec.rb"
         
     | 
| 
      
 74 
     | 
    
         
            +
                    test_file_for_get_many_path = test_dir_path + "/all_#{file_name}s_spec.rb"
         
     | 
| 
       74 
75 
     | 
    
         
             
                    FileUtils.mkdir_p(test_dir_path) unless File.exist?(test_dir_path)
         
     | 
| 
       75 
76 
     | 
    
         
             
                    template 'query_test.haml', test_file_path
         
     | 
| 
      
 77 
     | 
    
         
            +
                    template 'query_test_for_get_many.haml', test_file_for_get_many_path
         
     | 
| 
       76 
78 
     | 
    
         
             
                  end
         
     | 
| 
       77 
79 
     | 
    
         
             
                end
         
     | 
| 
       78 
80 
     | 
    
         
             
              end
         
     | 
| 
         @@ -5,14 +5,27 @@ require 'rails_helper' 
     | 
|
| 
       5 
5 
     | 
    
         
             
            RSpec.describe Types::Admin::<%= class_name %>Type, type: :request do
         
     | 
| 
       6 
6 
     | 
    
         
             
              let(:query) do
         
     | 
| 
       7 
7 
     | 
    
         
             
                <<-GRAPHQL
         
     | 
| 
       8 
     | 
    
         
            -
                  query {
         
     | 
| 
       9 
     | 
    
         
            -
                    <%= class_name 
     | 
| 
      
 8 
     | 
    
         
            +
                  query <%= class_name %>($id: ID!) {
         
     | 
| 
      
 9 
     | 
    
         
            +
                    <%= class_name %>(id: $id){
         
     | 
| 
      
 10 
     | 
    
         
            +
                      id
         
     | 
| 
      
 11 
     | 
    
         
            +
                    }
         
     | 
| 
       10 
12 
     | 
    
         
             
                  }
         
     | 
| 
       11 
13 
     | 
    
         
             
                GRAPHQL
         
     | 
| 
       12 
14 
     | 
    
         
             
              end
         
     | 
| 
       13 
15 
     | 
    
         | 
| 
      
 16 
     | 
    
         
            +
              let(:admin_user) { create :admin_user }
         
     | 
| 
       14 
17 
     | 
    
         
             
              describe '#resolve' do
         
     | 
| 
       15 
18 
     | 
    
         
             
                it 'pass' do
         
     | 
| 
      
 19 
     | 
    
         
            +
                  variables = <<~GQL
         
     | 
| 
      
 20 
     | 
    
         
            +
                    {
         
     | 
| 
      
 21 
     | 
    
         
            +
                      "id": #{admin_user.id}
         
     | 
| 
      
 22 
     | 
    
         
            +
                    }
         
     | 
| 
      
 23 
     | 
    
         
            +
                  GQL
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  post '/api/admin/graphql', headers: admin_user.create_new_auth_token, params: { query: query, variables: variables }
         
     | 
| 
      
 26 
     | 
    
         
            +
                  expect(response).to have_http_status(:success)
         
     | 
| 
      
 27 
     | 
    
         
            +
                  json = JSON.parse(response.body)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  expect(json['data']['<%= class_name %>']['id']).to eq admin_user.id
         
     | 
| 
       16 
29 
     | 
    
         
             
                end
         
     | 
| 
       17 
30 
     | 
    
         
             
              end
         
     | 
| 
       18 
31 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,39 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'rails_helper'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            RSpec.describe Types::Admin::<%= class_name %>Type, type: :request do
         
     | 
| 
      
 6 
     | 
    
         
            +
              let(:query) do
         
     | 
| 
      
 7 
     | 
    
         
            +
                <<-GRAPHQL
         
     | 
| 
      
 8 
     | 
    
         
            +
                  query all<%= class_name %>s($filter: FinalTestFilter, $page: Int, $perPage: Int, $sortField: String, $sortOrder: String) {
         
     | 
| 
      
 9 
     | 
    
         
            +
                    all<%= class_name %>s(filter: $filter, page: $page, perPage: $perPage, sortField: $sortField, sortOrder: $sortOrder){
         
     | 
| 
      
 10 
     | 
    
         
            +
                      id
         
     | 
| 
      
 11 
     | 
    
         
            +
                    }
         
     | 
| 
      
 12 
     | 
    
         
            +
                  }
         
     | 
| 
      
 13 
     | 
    
         
            +
                GRAPHQL
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              let(:admin_user) { create :admin_user }
         
     | 
| 
      
 17 
     | 
    
         
            +
              describe '#resolve' do
         
     | 
| 
      
 18 
     | 
    
         
            +
                it 'pass' do
         
     | 
| 
      
 19 
     | 
    
         
            +
                  variables = <<~GQL
         
     | 
| 
      
 20 
     | 
    
         
            +
                    {
         
     | 
| 
      
 21 
     | 
    
         
            +
                      "filter": ,
         
     | 
| 
      
 22 
     | 
    
         
            +
                      "page": ,
         
     | 
| 
      
 23 
     | 
    
         
            +
                      "perPage": ,
         
     | 
| 
      
 24 
     | 
    
         
            +
                      "sortField": ,
         
     | 
| 
      
 25 
     | 
    
         
            +
                      "sortOrder":
         
     | 
| 
      
 26 
     | 
    
         
            +
                    }
         
     | 
| 
      
 27 
     | 
    
         
            +
                  GQL
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  post '/api/admin/graphql', headers: admin_user.create_new_auth_token, params: { query: query, variables: variables }
         
     | 
| 
      
 30 
     | 
    
         
            +
                  expect(response).to have_http_status(:success)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  json = JSON.parse(response.body)
         
     | 
| 
      
 32 
     | 
    
         
            +
                  expect(json['data']['all'<%= class_name %>'s']['filter']).to eq
         
     | 
| 
      
 33 
     | 
    
         
            +
                  expect(json['data']['all'<%= class_name %>'s']['page']).to eq
         
     | 
| 
      
 34 
     | 
    
         
            +
                  expect(json['data']['all'<%= class_name %>'s']['perPage']).to eq
         
     | 
| 
      
 35 
     | 
    
         
            +
                  expect(json['data']['all'<%= class_name %>'s']['sortField']).to eq
         
     | 
| 
      
 36 
     | 
    
         
            +
                  expect(json['data']['all'<%= class_name %>'s']['sortOrder']).to eq
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: graphql_scaffold_fan
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Fan Zhang
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2022-08- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-08-08 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: graphql
         
     | 
| 
         @@ -72,6 +72,7 @@ files: 
     | 
|
| 
       72 
72 
     | 
    
         
             
            - lib/generators/templates/mutation_update.haml
         
     | 
| 
       73 
73 
     | 
    
         
             
            - lib/generators/templates/mutation_update_test.haml
         
     | 
| 
       74 
74 
     | 
    
         
             
            - lib/generators/templates/query_test.haml
         
     | 
| 
      
 75 
     | 
    
         
            +
            - lib/generators/templates/query_test_for_get_many.haml
         
     | 
| 
       75 
76 
     | 
    
         
             
            - lib/generators/templates/query_type.haml
         
     | 
| 
       76 
77 
     | 
    
         
             
            - lib/graphql_scaffold_fan.rb
         
     | 
| 
       77 
78 
     | 
    
         
             
            - lib/graphql_scaffold_fan/version.rb
         
     |