upgrow 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/upgrow.rb +2 -8
- data/lib/upgrow/action.rb +66 -16
- data/lib/upgrow/actions.rb +31 -0
- data/lib/upgrow/active_record_adapter.rb +24 -15
- data/lib/upgrow/active_record_schema.rb +63 -0
- data/lib/upgrow/basic_model.rb +64 -0
- data/lib/upgrow/basic_repository.rb +49 -22
- data/lib/upgrow/error.rb +19 -0
- data/lib/upgrow/immutable_object.rb +26 -21
- data/lib/upgrow/input.rb +7 -0
- data/lib/upgrow/model.rb +12 -12
- data/lib/upgrow/model_schema.rb +31 -0
- data/lib/upgrow/repository.rb +3 -0
- data/lib/upgrow/result.rb +18 -55
- data/lib/upgrow/schema.rb +33 -0
- data/test/application_system_test_case.rb +11 -0
- data/test/dummy/app/actions/application_action.rb +10 -0
- data/test/dummy/app/actions/articles/create_action.rb +15 -0
- data/test/dummy/app/actions/articles/destroy_action.rb +9 -0
- data/test/dummy/app/actions/articles/edit_action.rb +12 -0
- data/test/dummy/app/actions/articles/index_action.rb +11 -0
- data/test/dummy/app/actions/articles/new_action.rb +8 -0
- data/test/dummy/app/actions/articles/show_action.rb +11 -0
- data/test/dummy/app/actions/articles/update_action.rb +15 -0
- data/test/dummy/app/actions/comments/create_action.rb +15 -0
- data/test/dummy/app/actions/comments/destroy_action.rb +9 -0
- data/test/dummy/app/actions/comments/new_action.rb +8 -0
- data/test/dummy/app/actions/sessions/create_action.rb +23 -0
- data/test/dummy/app/actions/sessions/destroy_action.rb +6 -0
- data/test/dummy/app/actions/sessions/new_action.rb +8 -0
- data/test/dummy/app/actions/user_action.rb +10 -0
- data/test/dummy/app/actions/users/create_action.rb +13 -0
- data/test/dummy/app/actions/users/new_action.rb +8 -0
- data/test/dummy/app/controllers/application_controller.rb +10 -0
- data/test/dummy/app/controllers/articles_controller.rb +32 -28
- data/test/dummy/app/controllers/comments_controller.rb +41 -0
- data/test/dummy/app/controllers/sessions_controller.rb +34 -0
- data/test/dummy/app/controllers/users_controller.rb +29 -0
- data/test/dummy/app/helpers/application_helper.rb +27 -3
- data/test/dummy/app/helpers/users_helper.rb +15 -0
- data/test/dummy/app/inputs/article_input.rb +3 -0
- data/test/dummy/app/inputs/comment_input.rb +11 -0
- data/test/dummy/app/inputs/session_input.rb +9 -0
- data/test/dummy/app/inputs/user_input.rb +9 -0
- data/test/dummy/app/models/article.rb +0 -2
- data/test/dummy/app/models/comment.rb +4 -0
- data/test/dummy/app/models/user.rb +4 -0
- data/test/dummy/app/records/article_record.rb +2 -0
- data/test/dummy/app/records/comment_record.rb +7 -0
- data/test/dummy/app/records/user_record.rb +9 -0
- data/test/dummy/app/repositories/article_repository.rb +26 -0
- data/test/dummy/app/repositories/comment_repository.rb +3 -0
- data/test/dummy/app/repositories/user_repository.rb +12 -0
- data/test/dummy/config/routes.rb +6 -1
- data/test/dummy/db/migrate/20210320140432_create_comments.rb +12 -0
- data/test/dummy/db/migrate/20210409164927_create_users.rb +22 -0
- data/test/dummy/db/schema.rb +24 -1
- data/test/system/articles_test.rb +87 -29
- data/test/system/comments_test.rb +81 -0
- data/test/system/guest_user_test.rb +14 -0
- data/test/system/sign_in_test.rb +57 -0
- data/test/system/sign_out_test.rb +19 -0
- data/test/system/sign_up_test.rb +38 -0
- data/test/test_helper.rb +6 -1
- data/test/upgrow/action_test.rb +101 -9
- data/test/upgrow/actions_test.rb +24 -0
- data/test/upgrow/active_record_adapter_test.rb +12 -17
- data/test/upgrow/active_record_schema_test.rb +92 -0
- data/test/upgrow/basic_model_test.rb +95 -0
- data/test/upgrow/basic_repository_test.rb +48 -27
- data/test/upgrow/immutable_object_test.rb +43 -7
- data/test/upgrow/input_test.rb +19 -1
- data/test/upgrow/model_schema_test.rb +44 -0
- data/test/upgrow/model_test.rb +48 -11
- data/test/upgrow/result_test.rb +19 -64
- data/test/upgrow/schema_test.rb +44 -0
- metadata +128 -50
- data/test/dummy/app/actions/create_article_action.rb +0 -13
- data/test/dummy/app/actions/delete_article_action.rb +0 -7
- data/test/dummy/app/actions/edit_article_action.rb +0 -10
- data/test/dummy/app/actions/list_articles_action.rb +0 -8
- data/test/dummy/app/actions/show_article_action.rb +0 -10
- data/test/dummy/app/actions/update_article_action.rb +0 -13
data/test/upgrow/result_test.rb
CHANGED
@@ -13,83 +13,38 @@ module Upgrow
|
|
13
13
|
assert_equal([:user, :errors], result_class.members)
|
14
14
|
end
|
15
15
|
|
16
|
+
test '.new allows defining errors explicitly' do
|
17
|
+
result_class = Result.new(:user, :errors)
|
18
|
+
assert_equal([:user, :errors], result_class.members)
|
19
|
+
end
|
20
|
+
|
16
21
|
test '.new returns a Result class with only errors when called without arguments' do
|
17
22
|
result_class = Result.new
|
18
23
|
assert_equal([:errors], result_class.members)
|
19
24
|
end
|
20
25
|
|
21
|
-
test '.
|
22
|
-
|
23
|
-
|
24
|
-
assert_empty result.errors
|
25
|
-
end
|
26
|
-
|
27
|
-
test '.failure returns a Result populated with the given errors' do
|
28
|
-
result = Result.new(:user).failure(@errors)
|
29
|
-
assert_nil result.user
|
30
|
-
assert_equal @errors, result.errors
|
31
|
-
end
|
32
|
-
|
33
|
-
test '#and_then calls the given block and returns self for a successful Result' do
|
34
|
-
called = false
|
35
|
-
|
36
|
-
success = Result.new.success
|
37
|
-
|
38
|
-
returned_value = success.and_then { called = true }
|
39
|
-
|
40
|
-
assert called
|
41
|
-
assert_same success, returned_value
|
42
|
-
end
|
43
|
-
|
44
|
-
test '#or_else passes the Result values as an argument to the given block' do
|
45
|
-
success = Result.new(:user, :post)
|
46
|
-
.success(user: 'volmer', post: 'hello!')
|
47
|
-
|
48
|
-
success.and_then do |user:, post:|
|
49
|
-
assert_equal 'volmer', user
|
50
|
-
assert_equal 'hello!', post
|
26
|
+
test '.new does not accept duplicate members' do
|
27
|
+
error = assert_raises(ArgumentError) do
|
28
|
+
Result.new(:user, :user)
|
51
29
|
end
|
52
|
-
end
|
53
|
-
|
54
|
-
test '#and_then does not call the given block and returns self for a failure Result' do
|
55
|
-
called = false
|
56
|
-
|
57
|
-
failure = Result.new.failure(@errors)
|
58
|
-
|
59
|
-
returned_value = failure.and_then { called = true }
|
60
30
|
|
61
|
-
|
62
|
-
assert_same failure, returned_value
|
31
|
+
assert_equal 'duplicate member: user', error.message
|
63
32
|
end
|
64
33
|
|
65
|
-
test '
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
returned_value = success.or_else { called = true }
|
71
|
-
|
72
|
-
refute called
|
73
|
-
assert_same success, returned_value
|
34
|
+
test '.new.new returns a Result populated with the given values' do
|
35
|
+
result = Result.new(:user).new(user: 'volmer')
|
36
|
+
assert_equal 'volmer', result.user
|
37
|
+
assert_empty result.errors
|
74
38
|
end
|
75
39
|
|
76
|
-
test '#
|
77
|
-
|
78
|
-
|
79
|
-
failure = Result.new.failure(@errors)
|
80
|
-
|
81
|
-
returned_value = failure.or_else { called = true }
|
82
|
-
|
83
|
-
assert called
|
84
|
-
assert_same failure, returned_value
|
40
|
+
test '#success? is true when there are no errors' do
|
41
|
+
result = Result.new.new
|
42
|
+
assert_predicate result, :success?
|
85
43
|
end
|
86
44
|
|
87
|
-
test '#
|
88
|
-
|
89
|
-
|
90
|
-
failure.or_else do |errors|
|
91
|
-
assert_equal @errors, errors
|
92
|
-
end
|
45
|
+
test '#success? is false when there are errors' do
|
46
|
+
result = Result.new.new(errors: @errors)
|
47
|
+
refute_predicate result, :success?
|
93
48
|
end
|
94
49
|
end
|
95
50
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
module Upgrow
|
6
|
+
class SchemaTest < ActiveSupport::TestCase
|
7
|
+
setup do
|
8
|
+
@schema = Schema.new(:name, :email)
|
9
|
+
end
|
10
|
+
|
11
|
+
test '#attribute_names is empty by default' do
|
12
|
+
assert_empty Schema.new.attribute_names
|
13
|
+
end
|
14
|
+
|
15
|
+
test '#attribute_names returns the values from the Schema initialization' do
|
16
|
+
assert_equal [:name, :email], @schema.attribute_names
|
17
|
+
end
|
18
|
+
|
19
|
+
test '#attribute_names ignores duplicates' do
|
20
|
+
schema = Schema.new(:name, :email, :name)
|
21
|
+
assert_equal [:name, :email], schema.attribute_names
|
22
|
+
end
|
23
|
+
|
24
|
+
test '#attribute defines an extra attribute' do
|
25
|
+
@schema.attribute(:phone)
|
26
|
+
|
27
|
+
assert_equal [:name, :email, :phone], @schema.attribute_names
|
28
|
+
end
|
29
|
+
|
30
|
+
test '#attribute does not define the same attribute twice' do
|
31
|
+
@schema.attribute(:name)
|
32
|
+
|
33
|
+
assert_equal [:name, :email], @schema.attribute_names
|
34
|
+
end
|
35
|
+
|
36
|
+
test '#dup creates a Schema with independent attribute names' do
|
37
|
+
new_schema = @schema.dup
|
38
|
+
new_schema.attribute(:phone)
|
39
|
+
|
40
|
+
assert_equal [:name, :email], @schema.attribute_names
|
41
|
+
assert_equal [:name, :email, :phone], new_schema.attribute_names
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upgrow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify Engineering
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '6.1'
|
27
|
-
description:
|
27
|
+
description:
|
28
28
|
email: gems@shopify.com
|
29
29
|
executables: []
|
30
30
|
extensions: []
|
@@ -34,33 +34,63 @@ files:
|
|
34
34
|
- Rakefile
|
35
35
|
- lib/upgrow.rb
|
36
36
|
- lib/upgrow/action.rb
|
37
|
+
- lib/upgrow/actions.rb
|
37
38
|
- lib/upgrow/active_record_adapter.rb
|
39
|
+
- lib/upgrow/active_record_schema.rb
|
40
|
+
- lib/upgrow/basic_model.rb
|
38
41
|
- lib/upgrow/basic_repository.rb
|
42
|
+
- lib/upgrow/error.rb
|
39
43
|
- lib/upgrow/immutable_object.rb
|
40
44
|
- lib/upgrow/immutable_struct.rb
|
41
45
|
- lib/upgrow/input.rb
|
42
46
|
- lib/upgrow/model.rb
|
47
|
+
- lib/upgrow/model_schema.rb
|
43
48
|
- lib/upgrow/repository.rb
|
44
49
|
- lib/upgrow/result.rb
|
50
|
+
- lib/upgrow/schema.rb
|
45
51
|
- test/application_system_test_case.rb
|
46
|
-
- test/dummy/app/actions/
|
47
|
-
- test/dummy/app/actions/
|
48
|
-
- test/dummy/app/actions/
|
49
|
-
- test/dummy/app/actions/
|
50
|
-
- test/dummy/app/actions/
|
51
|
-
- test/dummy/app/actions/
|
52
|
+
- test/dummy/app/actions/application_action.rb
|
53
|
+
- test/dummy/app/actions/articles/create_action.rb
|
54
|
+
- test/dummy/app/actions/articles/destroy_action.rb
|
55
|
+
- test/dummy/app/actions/articles/edit_action.rb
|
56
|
+
- test/dummy/app/actions/articles/index_action.rb
|
57
|
+
- test/dummy/app/actions/articles/new_action.rb
|
58
|
+
- test/dummy/app/actions/articles/show_action.rb
|
59
|
+
- test/dummy/app/actions/articles/update_action.rb
|
60
|
+
- test/dummy/app/actions/comments/create_action.rb
|
61
|
+
- test/dummy/app/actions/comments/destroy_action.rb
|
62
|
+
- test/dummy/app/actions/comments/new_action.rb
|
63
|
+
- test/dummy/app/actions/sessions/create_action.rb
|
64
|
+
- test/dummy/app/actions/sessions/destroy_action.rb
|
65
|
+
- test/dummy/app/actions/sessions/new_action.rb
|
66
|
+
- test/dummy/app/actions/user_action.rb
|
67
|
+
- test/dummy/app/actions/users/create_action.rb
|
68
|
+
- test/dummy/app/actions/users/new_action.rb
|
52
69
|
- test/dummy/app/channels/application_cable/channel.rb
|
53
70
|
- test/dummy/app/channels/application_cable/connection.rb
|
54
71
|
- test/dummy/app/controllers/application_controller.rb
|
55
72
|
- test/dummy/app/controllers/articles_controller.rb
|
73
|
+
- test/dummy/app/controllers/comments_controller.rb
|
74
|
+
- test/dummy/app/controllers/sessions_controller.rb
|
75
|
+
- test/dummy/app/controllers/users_controller.rb
|
56
76
|
- test/dummy/app/helpers/application_helper.rb
|
77
|
+
- test/dummy/app/helpers/users_helper.rb
|
57
78
|
- test/dummy/app/inputs/article_input.rb
|
79
|
+
- test/dummy/app/inputs/comment_input.rb
|
80
|
+
- test/dummy/app/inputs/session_input.rb
|
81
|
+
- test/dummy/app/inputs/user_input.rb
|
58
82
|
- test/dummy/app/jobs/application_job.rb
|
59
83
|
- test/dummy/app/mailers/application_mailer.rb
|
60
84
|
- test/dummy/app/models/article.rb
|
85
|
+
- test/dummy/app/models/comment.rb
|
86
|
+
- test/dummy/app/models/user.rb
|
61
87
|
- test/dummy/app/records/application_record.rb
|
62
88
|
- test/dummy/app/records/article_record.rb
|
89
|
+
- test/dummy/app/records/comment_record.rb
|
90
|
+
- test/dummy/app/records/user_record.rb
|
63
91
|
- test/dummy/app/repositories/article_repository.rb
|
92
|
+
- test/dummy/app/repositories/comment_repository.rb
|
93
|
+
- test/dummy/app/repositories/user_repository.rb
|
64
94
|
- test/dummy/config/application.rb
|
65
95
|
- test/dummy/config/boot.rb
|
66
96
|
- test/dummy/config/environment.rb
|
@@ -80,26 +110,38 @@ files:
|
|
80
110
|
- test/dummy/config/puma.rb
|
81
111
|
- test/dummy/config/routes.rb
|
82
112
|
- test/dummy/db/migrate/20210219211631_create_articles.rb
|
113
|
+
- test/dummy/db/migrate/20210320140432_create_comments.rb
|
114
|
+
- test/dummy/db/migrate/20210409164927_create_users.rb
|
83
115
|
- test/dummy/db/schema.rb
|
84
116
|
- test/rails_helper.rb
|
85
117
|
- test/system/articles_test.rb
|
118
|
+
- test/system/comments_test.rb
|
119
|
+
- test/system/guest_user_test.rb
|
120
|
+
- test/system/sign_in_test.rb
|
121
|
+
- test/system/sign_out_test.rb
|
122
|
+
- test/system/sign_up_test.rb
|
86
123
|
- test/test_helper.rb
|
87
124
|
- test/upgrow/action_test.rb
|
125
|
+
- test/upgrow/actions_test.rb
|
88
126
|
- test/upgrow/active_record_adapter_test.rb
|
127
|
+
- test/upgrow/active_record_schema_test.rb
|
128
|
+
- test/upgrow/basic_model_test.rb
|
89
129
|
- test/upgrow/basic_repository_test.rb
|
90
130
|
- test/upgrow/documentation_test.rb
|
91
131
|
- test/upgrow/immutable_object_test.rb
|
92
132
|
- test/upgrow/immutable_struct_test.rb
|
93
133
|
- test/upgrow/input_test.rb
|
134
|
+
- test/upgrow/model_schema_test.rb
|
94
135
|
- test/upgrow/model_test.rb
|
95
136
|
- test/upgrow/result_test.rb
|
137
|
+
- test/upgrow/schema_test.rb
|
96
138
|
homepage: https://github.com/Shopify/upgrow
|
97
139
|
licenses:
|
98
140
|
- MIT
|
99
141
|
metadata:
|
100
|
-
source_code_uri: https://github.com/Shopify/upgrow/tree/v0.0.
|
142
|
+
source_code_uri: https://github.com/Shopify/upgrow/tree/v0.0.3
|
101
143
|
allowed_push_host: https://rubygems.org
|
102
|
-
post_install_message:
|
144
|
+
post_install_message:
|
103
145
|
rdoc_options: []
|
104
146
|
require_paths:
|
105
147
|
- lib
|
@@ -114,59 +156,95 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
156
|
- !ruby/object:Gem::Version
|
115
157
|
version: '0'
|
116
158
|
requirements: []
|
117
|
-
rubygems_version: 3.
|
118
|
-
signing_key:
|
159
|
+
rubygems_version: 3.2.15
|
160
|
+
signing_key:
|
119
161
|
specification_version: 4
|
120
162
|
summary: A sustainable architecture for Ruby on Rails.
|
121
163
|
test_files:
|
122
|
-
- test/
|
123
|
-
- test/dummy/
|
124
|
-
- test/dummy/app/
|
125
|
-
- test/dummy/app/
|
126
|
-
- test/dummy/app/
|
164
|
+
- test/application_system_test_case.rb
|
165
|
+
- test/dummy/app/actions/application_action.rb
|
166
|
+
- test/dummy/app/actions/articles/create_action.rb
|
167
|
+
- test/dummy/app/actions/articles/destroy_action.rb
|
168
|
+
- test/dummy/app/actions/articles/edit_action.rb
|
169
|
+
- test/dummy/app/actions/articles/index_action.rb
|
170
|
+
- test/dummy/app/actions/articles/new_action.rb
|
171
|
+
- test/dummy/app/actions/articles/show_action.rb
|
172
|
+
- test/dummy/app/actions/articles/update_action.rb
|
173
|
+
- test/dummy/app/actions/comments/create_action.rb
|
174
|
+
- test/dummy/app/actions/comments/destroy_action.rb
|
175
|
+
- test/dummy/app/actions/comments/new_action.rb
|
176
|
+
- test/dummy/app/actions/sessions/create_action.rb
|
177
|
+
- test/dummy/app/actions/sessions/destroy_action.rb
|
178
|
+
- test/dummy/app/actions/sessions/new_action.rb
|
179
|
+
- test/dummy/app/actions/user_action.rb
|
180
|
+
- test/dummy/app/actions/users/create_action.rb
|
181
|
+
- test/dummy/app/actions/users/new_action.rb
|
182
|
+
- test/dummy/app/channels/application_cable/channel.rb
|
183
|
+
- test/dummy/app/channels/application_cable/connection.rb
|
127
184
|
- test/dummy/app/controllers/application_controller.rb
|
185
|
+
- test/dummy/app/controllers/articles_controller.rb
|
186
|
+
- test/dummy/app/controllers/comments_controller.rb
|
187
|
+
- test/dummy/app/controllers/sessions_controller.rb
|
188
|
+
- test/dummy/app/controllers/users_controller.rb
|
189
|
+
- test/dummy/app/helpers/application_helper.rb
|
190
|
+
- test/dummy/app/helpers/users_helper.rb
|
191
|
+
- test/dummy/app/inputs/article_input.rb
|
192
|
+
- test/dummy/app/inputs/comment_input.rb
|
193
|
+
- test/dummy/app/inputs/session_input.rb
|
194
|
+
- test/dummy/app/inputs/user_input.rb
|
128
195
|
- test/dummy/app/jobs/application_job.rb
|
196
|
+
- test/dummy/app/mailers/application_mailer.rb
|
197
|
+
- test/dummy/app/models/article.rb
|
198
|
+
- test/dummy/app/models/comment.rb
|
199
|
+
- test/dummy/app/models/user.rb
|
129
200
|
- test/dummy/app/records/application_record.rb
|
130
201
|
- test/dummy/app/records/article_record.rb
|
131
|
-
- test/dummy/app/
|
132
|
-
- test/dummy/app/
|
133
|
-
- test/dummy/app/actions/delete_article_action.rb
|
134
|
-
- test/dummy/app/actions/update_article_action.rb
|
135
|
-
- test/dummy/app/actions/list_articles_action.rb
|
136
|
-
- test/dummy/app/actions/edit_article_action.rb
|
137
|
-
- test/dummy/app/actions/show_article_action.rb
|
138
|
-
- test/dummy/app/models/article.rb
|
139
|
-
- test/dummy/app/channels/application_cable/channel.rb
|
140
|
-
- test/dummy/app/channels/application_cable/connection.rb
|
202
|
+
- test/dummy/app/records/comment_record.rb
|
203
|
+
- test/dummy/app/records/user_record.rb
|
141
204
|
- test/dummy/app/repositories/article_repository.rb
|
205
|
+
- test/dummy/app/repositories/comment_repository.rb
|
206
|
+
- test/dummy/app/repositories/user_repository.rb
|
207
|
+
- test/dummy/config/application.rb
|
208
|
+
- test/dummy/config/boot.rb
|
209
|
+
- test/dummy/config/environment.rb
|
210
|
+
- test/dummy/config/environments/development.rb
|
211
|
+
- test/dummy/config/environments/production.rb
|
212
|
+
- test/dummy/config/environments/test.rb
|
213
|
+
- test/dummy/config/initializers/application_controller_renderer.rb
|
142
214
|
- test/dummy/config/initializers/assets.rb
|
143
|
-
- test/dummy/config/initializers/
|
215
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
144
216
|
- test/dummy/config/initializers/content_security_policy.rb
|
145
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
146
|
-
- test/dummy/config/initializers/application_controller_renderer.rb
|
147
|
-
- test/dummy/config/initializers/permissions_policy.rb
|
148
217
|
- test/dummy/config/initializers/cookies_serializer.rb
|
149
|
-
- test/dummy/config/initializers/
|
150
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
218
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
151
219
|
- test/dummy/config/initializers/inflections.rb
|
152
|
-
- test/dummy/config/
|
153
|
-
- test/dummy/config/
|
220
|
+
- test/dummy/config/initializers/mime_types.rb
|
221
|
+
- test/dummy/config/initializers/permissions_policy.rb
|
222
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
154
223
|
- test/dummy/config/puma.rb
|
155
|
-
- test/dummy/config/
|
156
|
-
- test/dummy/
|
157
|
-
- test/dummy/
|
158
|
-
- test/dummy/
|
159
|
-
- test/dummy/
|
224
|
+
- test/dummy/config/routes.rb
|
225
|
+
- test/dummy/db/migrate/20210219211631_create_articles.rb
|
226
|
+
- test/dummy/db/migrate/20210320140432_create_comments.rb
|
227
|
+
- test/dummy/db/migrate/20210409164927_create_users.rb
|
228
|
+
- test/dummy/db/schema.rb
|
160
229
|
- test/rails_helper.rb
|
161
|
-
- test/application_system_test_case.rb
|
162
230
|
- test/system/articles_test.rb
|
163
|
-
- test/
|
164
|
-
- test/
|
165
|
-
- test/
|
166
|
-
- test/
|
231
|
+
- test/system/comments_test.rb
|
232
|
+
- test/system/guest_user_test.rb
|
233
|
+
- test/system/sign_in_test.rb
|
234
|
+
- test/system/sign_out_test.rb
|
235
|
+
- test/system/sign_up_test.rb
|
236
|
+
- test/test_helper.rb
|
167
237
|
- test/upgrow/action_test.rb
|
238
|
+
- test/upgrow/actions_test.rb
|
239
|
+
- test/upgrow/active_record_adapter_test.rb
|
240
|
+
- test/upgrow/active_record_schema_test.rb
|
241
|
+
- test/upgrow/basic_model_test.rb
|
242
|
+
- test/upgrow/basic_repository_test.rb
|
168
243
|
- test/upgrow/documentation_test.rb
|
169
|
-
- test/upgrow/
|
244
|
+
- test/upgrow/immutable_object_test.rb
|
245
|
+
- test/upgrow/immutable_struct_test.rb
|
170
246
|
- test/upgrow/input_test.rb
|
171
|
-
- test/upgrow/
|
172
|
-
- test/
|
247
|
+
- test/upgrow/model_schema_test.rb
|
248
|
+
- test/upgrow/model_test.rb
|
249
|
+
- test/upgrow/result_test.rb
|
250
|
+
- test/upgrow/schema_test.rb
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
class CreateArticleAction < Upgrow::Action
|
3
|
-
result :article
|
4
|
-
|
5
|
-
def perform(input)
|
6
|
-
if input.valid?
|
7
|
-
article = ArticleRepository.new.create(input)
|
8
|
-
result.success(article: article)
|
9
|
-
else
|
10
|
-
result.failure(input.errors)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|