souls 0.25.15 → 0.25.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/souls/generate/mutation.rb +1 -1
- data/lib/souls/generate/rspec_policy.rb +3 -3
- data/lib/souls/generate/rspec_query.rb +35 -35
- data/lib/souls/generate/rspec_resolver.rb +44 -44
- data/lib/souls/version.rb +1 -1
- data/lib/souls/versions/.souls_api_version +1 -1
- data/lib/souls/versions/.souls_worker_version +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: 4e8b0af25e3d9a42b03bba36beefe296a3ad4071e42afdba29bdb611f45bc4c5
|
4
|
+
data.tar.gz: ae642be3d64d0d5da50c0547de050e7d5e58d55bbcdf991ba0e8c7e90063f2f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95a0d969315e1a81c5ed126fba58d5929aa78ad9311d89dd8671472b07bf98da92b7f7047843b4a50ac2601a01eec41228ca4707e3e64222c41a7aceb2fd6dec
|
7
|
+
data.tar.gz: c693b388d8b5123ff9ac3b6610fe8cbe661158d5bcde0a7781c0b9dffe4a84fa4c2df1a639e84b8b42ceb8e035bb81148694220be68fcaf477092ae8c0a52735
|
@@ -10,7 +10,7 @@ module Souls
|
|
10
10
|
File.open(file_path, "w") do |new_line|
|
11
11
|
new_line.write(<<~TEXT)
|
12
12
|
module Mutations
|
13
|
-
module
|
13
|
+
module Base::#{singularized_class_name.camelize}
|
14
14
|
class Create#{singularized_class_name.camelize} < BaseMutation
|
15
15
|
field :#{singularized_class_name}_edge, Types::#{singularized_class_name.camelize}.edge_type, null: false
|
16
16
|
field :error, String, null: true
|
@@ -15,7 +15,7 @@ module Souls
|
|
15
15
|
let(:#{class_name.underscore}) { FactoryBot.create(:#{class_name.underscore}) }
|
16
16
|
|
17
17
|
context "being a visitor" do
|
18
|
-
let(:user) { FactoryBot.create(:user,
|
18
|
+
let(:user) { FactoryBot.create(:user, roles: :normal) }
|
19
19
|
|
20
20
|
it { is_expected.to permit_action(:index) }
|
21
21
|
it { is_expected.to permit_action(:show) }
|
@@ -23,13 +23,13 @@ module Souls
|
|
23
23
|
end
|
24
24
|
|
25
25
|
context "being a user" do
|
26
|
-
let(:user) { FactoryBot.create(:user,
|
26
|
+
let(:user) { FactoryBot.create(:user, roles: :user) }
|
27
27
|
|
28
28
|
it { is_expected.to permit_actions([:create, :update]) }
|
29
29
|
end
|
30
30
|
|
31
31
|
context "being an admin" do
|
32
|
-
let(:user) { FactoryBot.create(:user,
|
32
|
+
let(:user) { FactoryBot.create(:user, roles: :admin) }
|
33
33
|
|
34
34
|
it { is_expected.to permit_actions([:create, :update, :delete]) }
|
35
35
|
end
|
@@ -26,23 +26,23 @@ module Souls
|
|
26
26
|
if line.include?("end") || line.include?("t.index")
|
27
27
|
if @relation_params.empty?
|
28
28
|
new_line.write(<<-TEXT)
|
29
|
-
|
29
|
+
let!(:#{class_name}) { FactoryBot.create(:#{class_name}) }
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
let(:query) do
|
32
|
+
data_id = Base64.encode64("#{class_name.camelize}:\#{#{class_name.singularize.underscore}.id}")
|
33
|
+
%(query {
|
34
|
+
#{class_name.singularize.camelize(:lower)}(id: \\"\#{data_id}\\") {
|
35
|
+
id
|
36
36
|
TEXT
|
37
37
|
else
|
38
38
|
new_line.write(<<-TEXT)
|
39
|
-
|
39
|
+
let(:#{class_name}) { FactoryBot.create(:#{class_name}, #{@relation_params.join(', ')}) }
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
41
|
+
let(:query) do
|
42
|
+
data_id = Base64.encode64("#{class_name.camelize}:\#{#{class_name.singularize.underscore}.id}")
|
43
|
+
%(query {
|
44
|
+
#{class_name.singularize.camelize(:lower)}(id: \\"\#{data_id}\\") {
|
45
|
+
id
|
46
46
|
TEXT
|
47
47
|
end
|
48
48
|
break
|
@@ -70,25 +70,25 @@ module Souls
|
|
70
70
|
f.each_line.with_index do |line, _i|
|
71
71
|
if @on
|
72
72
|
if line.include?("end") || line.include?("t.index")
|
73
|
-
new_line.write(
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
73
|
+
new_line.write(<<-TEXT)
|
74
|
+
}
|
75
|
+
}
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
79
|
+
subject(:result) do
|
80
|
+
SoulsApiSchema.execute(query).as_json
|
81
|
+
end
|
82
|
+
|
83
|
+
it "return #{class_name.camelize} Data" do
|
84
|
+
begin
|
85
|
+
a1 = result.dig("data", "#{class_name.singularize.camelize(:lower)}")
|
86
|
+
raise unless a1.present?
|
87
|
+
rescue
|
88
|
+
raise StandardError, result
|
89
|
+
end
|
90
|
+
expect(a1).to include(
|
91
|
+
"id" => be_a(String),
|
92
92
|
TEXT
|
93
93
|
break
|
94
94
|
end
|
@@ -133,14 +133,14 @@ module Souls
|
|
133
133
|
case type
|
134
134
|
when "text", "date", "datetime"
|
135
135
|
if array_true
|
136
|
-
new_line.write("
|
136
|
+
new_line.write(" \"#{name.camelize(:lower)}\" => be_all(String),\n")
|
137
137
|
else
|
138
|
-
new_line.write("
|
138
|
+
new_line.write(" \"#{name.camelize(:lower)}\" => be_a(String),\n")
|
139
139
|
end
|
140
140
|
when "boolean"
|
141
|
-
new_line.write("
|
141
|
+
new_line.write(" \"#{name.singularize.camelize(:lower)}\" => be_in([true, false]),\n")
|
142
142
|
when "string", "bigint", "integer", "float"
|
143
|
-
new_line.write("
|
143
|
+
new_line.write(" \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n")
|
144
144
|
end
|
145
145
|
end
|
146
146
|
end
|
@@ -26,31 +26,31 @@ module Souls
|
|
26
26
|
if line.include?("end") || line.include?("t.index")
|
27
27
|
if @relation_params.empty?
|
28
28
|
new_line.write(<<-TEXT)
|
29
|
-
|
29
|
+
let!(:#{class_name}) { FactoryBot.create(:#{class_name}) }
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
31
|
+
let(:query) do
|
32
|
+
%(query {
|
33
|
+
#{class_name.singularize.camelize(:lower)}Search(filter: {
|
34
|
+
isDeleted: false
|
35
|
+
}) {
|
36
|
+
edges {
|
37
|
+
cursor
|
38
|
+
node {
|
39
|
+
id
|
40
40
|
TEXT
|
41
41
|
else
|
42
42
|
new_line.write(<<-TEXT)
|
43
|
-
|
43
|
+
let!(:#{class_name}) { FactoryBot.create(:#{class_name}, #{@relation_params.join(', ')}) }
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
45
|
+
let(:query) do
|
46
|
+
%(query {
|
47
|
+
#{class_name.singularize.camelize(:lower)}Search(filter: {
|
48
|
+
isDeleted: false
|
49
|
+
}) {
|
50
|
+
edges {
|
51
|
+
cursor
|
52
|
+
node {
|
53
|
+
id
|
54
54
|
TEXT
|
55
55
|
end
|
56
56
|
break
|
@@ -79,35 +79,35 @@ module Souls
|
|
79
79
|
if @on
|
80
80
|
if line.include?("end") || line.include?("t.index")
|
81
81
|
new_line.write(<<-TEXT)
|
82
|
+
}
|
83
|
+
}
|
84
|
+
nodes {
|
85
|
+
id
|
86
|
+
}
|
87
|
+
pageInfo {
|
88
|
+
endCursor
|
89
|
+
hasNextPage
|
90
|
+
startCursor
|
91
|
+
hasPreviousPage
|
82
92
|
}
|
83
|
-
}
|
84
|
-
nodes {
|
85
|
-
id
|
86
|
-
}
|
87
|
-
pageInfo {
|
88
|
-
endCursor
|
89
|
-
hasNextPage
|
90
|
-
startCursor
|
91
|
-
hasPreviousPage
|
92
93
|
}
|
93
94
|
}
|
94
|
-
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
|
-
subject(:result) do
|
99
|
-
SoulsApiSchema.execute(query).as_json
|
100
|
-
end
|
95
|
+
)
|
96
|
+
end
|
101
97
|
|
102
|
-
|
103
|
-
|
104
|
-
a1 = result.dig("data", "#{class_name.singularize.camelize(:lower)}Search", "edges")[0]["node"]
|
105
|
-
raise unless a1.present?
|
106
|
-
rescue
|
107
|
-
raise StandardError, result
|
98
|
+
subject(:result) do
|
99
|
+
SoulsApiSchema.execute(query).as_json
|
108
100
|
end
|
109
|
-
|
110
|
-
|
101
|
+
|
102
|
+
it "return #{class_name.camelize} Data" do
|
103
|
+
begin
|
104
|
+
a1 = result.dig("data", "#{class_name.singularize.camelize(:lower)}Search", "edges")[0]["node"]
|
105
|
+
raise unless a1.present?
|
106
|
+
rescue
|
107
|
+
raise StandardError, result
|
108
|
+
end
|
109
|
+
expect(a1).to include(
|
110
|
+
"id" => be_a(String),
|
111
111
|
TEXT
|
112
112
|
break
|
113
113
|
end
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.19
|
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.19
|