souls 0.30.3 → 0.30.7

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: 4a726d34c53e9d5c3d6faced80c9969fb57583800dc0bb8d037df70cb7aa52a7
4
- data.tar.gz: 05bc438a0b75dea4dc910f249fad1b1580cdca60c2ce527d9da8fa408b69d602
3
+ metadata.gz: 7a4d1d8b20011a9f2b4b1fa48ad73092a33c8bd25ac14691d54bf3b3be48f91f
4
+ data.tar.gz: 9c6c2e0c54fb914c4b077b00dd1301a4145a9b890384a0567ced64dda532d973
5
5
  SHA512:
6
- metadata.gz: d587c45bbbc5887bcc8cfb02647326e070dbca7fe1971399ffe91a858121667c92baf5d25947e5cbeb032a5731180c05836f15ba36ba95b0ee4dd222598fd892
7
- data.tar.gz: 1861aea9fceeba6a02d37ada11ef0e6b5b8a1e088d2bde2f76d322faeff2889e16bba81dd0eb094027cc4444b5a57bc173bd163dc1e0c50c2a5e708f392cafb6
6
+ metadata.gz: 68fff94ac5906851ebd89a3a544136b9158976488a367e069ab334833e6ee6964fc1fa5334ee090ae20ee589d3967c468473eb3a98267d646bf2fd49db62f86f
7
+ data.tar.gz: 2d460978cbae9f2699a773088a0d5b9fb562ec4e40e290f2f837157fd0221951a2aa9409598002a87e658a33b3f4c30d378b80eb291d23cc0a3476327b0b7560
@@ -74,6 +74,19 @@ module Souls
74
74
  }[type.to_sym]
75
75
  end
76
76
 
77
+ def self.get_type(type)
78
+ {
79
+ bigint: "Integer",
80
+ string: "String",
81
+ float: "Float",
82
+ text: "String",
83
+ datetime: "GraphQL::Types::ISO8601DateTime",
84
+ date: "GraphQL::Types::ISO8601DateTime",
85
+ boolean: "Boolean",
86
+ integer: "Integer"
87
+ }[type.to_sym]
88
+ end
89
+
77
90
  def self.get_test_type(type)
78
91
  {
79
92
  bigint: "rand(1..10)",
@@ -19,9 +19,10 @@ module Souls
19
19
  type = Souls::Api::Generate.type_check(col[:type])
20
20
  type = "[#{type}]" if col[:array]
21
21
  args = check_mutation_argument(class_name: class_name)
22
- unless args.include?(col[:column_name])
23
- new_line.write(" argument :#{col[:column_name]}, #{type}, required: false\n")
24
- end
22
+ next if args.include?(col[:column_name])
23
+ next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
24
+
25
+ new_line.write(" argument :#{col[:column_name]}, #{type}, required: false\n")
25
26
  end
26
27
  argument = true
27
28
  end
@@ -49,9 +50,10 @@ module Souls
49
50
  type = Souls::Api::Generate.type_check(col[:type])
50
51
  type = "[#{type}]" if col[:array]
51
52
  args = check_mutation_argument(class_name: class_name, action: "update")
52
- unless args.include?(col[:column_name])
53
- new_line.write(" argument :#{col[:column_name]}, #{type}, required: false\n")
54
- end
53
+ next if args.include?(col[:column_name])
54
+ next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
55
+
56
+ new_line.write(" argument :#{col[:column_name]}, #{type}, required: false\n")
55
57
  end
56
58
  argument = true
57
59
  end
@@ -17,6 +17,8 @@ module Souls
17
17
  next unless line.include?("{") && !argument
18
18
 
19
19
  new_cols.each do |col|
20
+ next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
21
+
20
22
  type = Souls::Api::Generate.get_test_type(col[:type])
21
23
  type = "[#{type}]" if col[:array]
22
24
  args = check_factory_argument(class_name: class_name)
@@ -23,11 +23,13 @@ module Souls
23
23
  if line.include?('#{') && !argument
24
24
  new_cols.each do |col|
25
25
  type = Souls::Api::Generate.type_check(col[:type])
26
- if type == "String" && !col[:array]
27
- type_line = " #{col[:column_name].singularize.camelize(:lower)}: \"\#{#{class_name.singularize}[:#{col[:column_name].singularize.underscore}]}\"\n"
28
- else
29
- type_line = " #{col[:column_name].singularize.camelize(:lower)}: \#{#{class_name.singularize}[:#{col[:column_name].singularize.underscore}]}\n"
30
- end
26
+ next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
27
+ type_line =
28
+ if type == "String" && !col[:array]
29
+ " #{col[:column_name].camelize(:lower)}: \"\#{#{class_name}[:#{col[:column_name].underscore}]}\"\n"
30
+ else
31
+ " #{col[:column_name].camelize(:lower)}: \#{#{class_name}[:#{col[:column_name].underscore}]}\n"
32
+ end
31
33
  args = check_rspec_mutation_argument(class_name: class_name)
32
34
  new_line.write(type_line) unless args.include?(col[:column_name].singularize.underscore)
33
35
  end
@@ -35,7 +37,9 @@ module Souls
35
37
  elsif node_res && !line.include?("{")
36
38
  node_args = check_rspec_mutation_argument(class_name: class_name, action: "node_args")
37
39
  new_cols.each do |col|
38
- new_line.write(" #{col[:column_name]}\n") unless node_args.include?(col[:column_name])
40
+ unless node_args.include?(col[:column_name])
41
+ new_line.write(" #{col[:column_name].camelize(:lower)}\n")
42
+ end
39
43
  end
40
44
  node_res = false
41
45
  elsif test_res && line.include?("=> be_")
@@ -54,7 +58,7 @@ module Souls
54
58
  col[:array] ? "be_all(String)" : "be_a(String)"
55
59
  end
56
60
  unless test_args.include?(col[:column_name])
57
- new_line.write(" \"#{col[:column_name]}\" => #{text},\n")
61
+ new_line.write(" \"#{col[:column_name].camelize(:lower)}\" => #{text},\n")
58
62
  end
59
63
  end
60
64
  test_res = false
@@ -23,7 +23,7 @@ module Souls
23
23
  node_args = check_rspec_resolver_argument(class_name: class_name, action: "node_args")
24
24
  new_cols.each do |col|
25
25
  unless node_args.include?(col[:column_name])
26
- new_line.write(" #{col[:column_name].camelize}\n")
26
+ new_line.write(" #{col[:column_name].camelize(:lower)}\n")
27
27
  end
28
28
  end
29
29
  node_res = false
@@ -43,7 +43,7 @@ module Souls
43
43
  col[:array] ? "be_all(String)" : "be_a(String)"
44
44
  end
45
45
  unless test_args.include?(col[:column_name])
46
- new_line.write(" \"#{col[:column_name]}\" => #{text},\n")
46
+ new_line.write(" \"#{col[:column_name].camelize(:lower)}\" => #{text},\n")
47
47
  end
48
48
  end
49
49
  test_res = false
@@ -16,7 +16,7 @@ module Souls
16
16
  next unless line.include?("field") && !argument
17
17
 
18
18
  new_cols.each do |col|
19
- type = Souls::Api::Generate.type_check(col[:type])
19
+ type = Souls::Api::Generate.get_type(col[:type])
20
20
  type = "[#{type}]" if col[:array]
21
21
  args = check_type_argument(class_name: class_name)
22
22
  unless args.include?(col[:column_name])
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.30.3".freeze
2
+ VERSION = "0.30.7".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.9.3
1
+ 0.9.7
@@ -1 +1 @@
1
- 0.9.3
1
+ 0.9.7
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: souls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.3
4
+ version: 0.30.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI