souls 0.13.8 → 0.13.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/souls/init.rb +31 -4
- data/lib/souls/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbcbcf33c2d8228114814ed5964c6cca8aba01902b953908081fe83cd2a1bdbb
|
4
|
+
data.tar.gz: 449d4d9de9382a3887464ef61c90858bf46c0e20cfd25bd44eef3c5e278a0b8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9241c9826bbd18c5d2d27501de5ce55236ecab6099949d0725fd3147028276cf98bec9f775278e263960e20c402a85d80368982d3a49141eae181eec1b0dc6a4
|
7
|
+
data.tar.gz: cfa3dbb3166216147d3e4cce41d2a0ee78c7c3b40ba74df241393b8b2e41c691cd0961a04e834f84d71ffd65ce78dc32f04d81188f2ffcd0365189ccdb27dacd
|
data/Gemfile.lock
CHANGED
data/lib/souls/init.rb
CHANGED
@@ -723,7 +723,6 @@ module Souls
|
|
723
723
|
f.write <<~EOS
|
724
724
|
RSpec.describe \"#{class_name.camelize} Mutation テスト\" do
|
725
725
|
describe "#{class_name.camelize} データを登録する" do
|
726
|
-
get_global_key = proc {|class_name, id| Base64.encode64(\"\#{class_name}:\#{id}\")}
|
727
726
|
EOS
|
728
727
|
end
|
729
728
|
end
|
@@ -739,17 +738,32 @@ module Souls
|
|
739
738
|
f.each_line.with_index do |line, i|
|
740
739
|
if @on
|
741
740
|
if line.include?("end") || line.include?("t.index")
|
742
|
-
|
741
|
+
if @relation_params.empty?
|
742
|
+
new_line.write <<-EOS
|
743
|
+
let(:#{class_name}) { FactoryBot.attributes_for(:#{class_name}) }
|
744
|
+
|
745
|
+
let(:mutation) do
|
746
|
+
%(mutation {
|
747
|
+
create#{class_name.camelize}(input: {
|
748
|
+
EOS
|
749
|
+
else
|
750
|
+
new_line.write <<-EOS
|
751
|
+
|
752
|
+
get_global_key = proc { |class_name, id| Base64.encode64(\"\#{class_name}:\#{id}\") }
|
743
753
|
let(:#{class_name}) { FactoryBot.attributes_for(:#{class_name}, #{@relation_params.join(", ")}) }
|
744
754
|
|
745
755
|
let(:mutation) do
|
746
756
|
%(mutation {
|
747
757
|
create#{class_name.camelize}(input: {
|
748
|
-
|
758
|
+
EOS
|
759
|
+
end
|
749
760
|
break
|
750
761
|
end
|
751
762
|
_, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
752
763
|
case name
|
764
|
+
when "user_id"
|
765
|
+
relation_col = name.gsub("_id", "")
|
766
|
+
new_line.write " let(:#{relation_col}) { FactoryBot.create(:#{relation_col}) }\n"
|
753
767
|
when /$*_id\z/
|
754
768
|
relation_col = name.gsub("_id", "")
|
755
769
|
@relation_params << "#{name}: get_global_key.call(\"#{name.singularize.camelize.gsub("Id", "")}\", #{relation_col}.id)"
|
@@ -789,7 +803,7 @@ module Souls
|
|
789
803
|
else
|
790
804
|
case type
|
791
805
|
when "string", "text", "date", "datetime"
|
792
|
-
if array_true
|
806
|
+
if array_true
|
793
807
|
new_line.write " #{name.pluralize.camelize(:lower)}: \#{#{class_name.singularize}[:#{name.pluralize.underscore}]}\n"
|
794
808
|
else
|
795
809
|
new_line.write " #{name.singularize.camelize(:lower)}: \"\#{#{class_name.singularize}[:#{name.singularize.underscore}]}\"\n"
|
@@ -954,6 +968,18 @@ module Souls
|
|
954
968
|
f.each_line.with_index do |line, i|
|
955
969
|
if @on
|
956
970
|
if line.include?("end") || line.include?("t.index")
|
971
|
+
if @relation_params.empty?
|
972
|
+
new_line.write <<-EOS
|
973
|
+
let(:#{class_name}) { FactoryBot.create(:#{class_name} }
|
974
|
+
|
975
|
+
let(:query) do
|
976
|
+
data_id = Base64.encode64("#{class_name.camelize}:\#{#{class_name.singularize.underscore}.id}")
|
977
|
+
%(query {
|
978
|
+
#{class_name.singularize.camelize(:lower)}(id: \\"\#{data_id}\\") {
|
979
|
+
id
|
980
|
+
EOS
|
981
|
+
break
|
982
|
+
else
|
957
983
|
new_line.write <<-EOS
|
958
984
|
let(:#{class_name}) { FactoryBot.create(:#{class_name}, #{@relation_params.join(", ")}) }
|
959
985
|
|
@@ -964,6 +990,7 @@ module Souls
|
|
964
990
|
id
|
965
991
|
EOS
|
966
992
|
break
|
993
|
+
end
|
967
994
|
end
|
968
995
|
_, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
969
996
|
case name
|
data/lib/souls/version.rb
CHANGED