workarea-core 3.5.16 → 3.5.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/mailers/workarea/application_mailer.rb +4 -1
- data/app/models/workarea/checkout.rb +6 -2
- data/app/models/workarea/data_file/csv.rb +9 -1
- data/app/models/workarea/inquiry.rb +2 -1
- data/config/locales/en.yml +2 -0
- data/lib/generators/workarea/install/install_generator.rb +13 -0
- data/lib/generators/workarea/install/templates/initializer.rb.erb +1 -1
- data/lib/workarea/version.rb +1 -1
- data/test/generators/workarea/install_generator_test.rb +6 -0
- data/test/mailers/workarea/application_mailer_test.rb +10 -0
- data/test/models/workarea/checkout_test.rb +57 -0
- data/test/models/workarea/data_file/import_test.rb +40 -0
- data/workarea-core.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d24b6af137b806311dbd5d13fb13a57f8693f99d767f94fb3144994fe9c7028
|
4
|
+
data.tar.gz: dbbfb80358c11fc03b2e470ac741f615dc2d68e5f9c6c0d55b3b69567eaa4d02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7f587ddc4e1e9c425eaace526f562f99ec5885002f833fd33a134164d3d20a405938a1e762b3cfd221824a77f435ebb79383591ae2bd0c3b81bd407ba0ceb12
|
7
|
+
data.tar.gz: 61da7b2aa4a72d5e0b5456b401f9124769fa5f43c601d33e6e14b6a64bf820910bed36faf6992a1865e603455710b05647fa62b62488fa8fd973d33edac02564
|
@@ -8,7 +8,10 @@ module Workarea
|
|
8
8
|
default from: -> (*) { Workarea.config.email_from }
|
9
9
|
|
10
10
|
def default_url_options(options = {})
|
11
|
-
super
|
11
|
+
# super isn't returning the configured options, so manually merge them in
|
12
|
+
super
|
13
|
+
.merge(Rails.application.config.action_mailer.default_url_options.to_h)
|
14
|
+
.merge(host: Workarea.config.host)
|
12
15
|
end
|
13
16
|
end
|
14
17
|
end
|
@@ -154,10 +154,14 @@ module Workarea
|
|
154
154
|
# Used in auto completing an order for a logged in user.
|
155
155
|
#
|
156
156
|
# @param [Hash] parameters for updating
|
157
|
-
# @return [
|
157
|
+
# @return [Boolean] whether the update was successful.
|
158
158
|
#
|
159
159
|
def update(params = {})
|
160
|
-
|
160
|
+
return true if params.blank?
|
161
|
+
|
162
|
+
steps.reduce(true) do |result, step|
|
163
|
+
result &= step.new(self).update(params)
|
164
|
+
end
|
161
165
|
end
|
162
166
|
|
163
167
|
# Whether this checkout needs any further information
|
@@ -17,7 +17,15 @@ module Workarea
|
|
17
17
|
assign_attributes(root, attrs)
|
18
18
|
assign_embedded_attributes(root, attrs)
|
19
19
|
|
20
|
-
|
20
|
+
possibly_affected_models = root.embedded_children + [root]
|
21
|
+
was_successful = true
|
22
|
+
|
23
|
+
possibly_affected_models.each do |model|
|
24
|
+
meaningful_changes = model.changes.except('updated_at')
|
25
|
+
was_successful &= model.save if model.changed? && meaningful_changes.present?
|
26
|
+
end
|
27
|
+
|
28
|
+
if was_successful || failed_new_record_ids.exclude?(id)
|
21
29
|
log(index, root)
|
22
30
|
else
|
23
31
|
operation.total += 1 # ensure line numbers remain consistent
|
data/config/locales/en.yml
CHANGED
@@ -55,6 +55,19 @@ module Workarea
|
|
55
55
|
remove_file 'public/favicon.ico'
|
56
56
|
end
|
57
57
|
|
58
|
+
def add_development_mailer_port
|
59
|
+
development_port = <<-CODE
|
60
|
+
|
61
|
+
config.action_mailer.default_url_options = { port: 3000 }
|
62
|
+
CODE
|
63
|
+
|
64
|
+
inject_into_file(
|
65
|
+
'config/environments/development.rb',
|
66
|
+
development_port,
|
67
|
+
before: /^end/
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
58
71
|
private
|
59
72
|
|
60
73
|
def app_name
|
data/lib/workarea/version.rb
CHANGED
@@ -81,5 +81,11 @@ module Workarea
|
|
81
81
|
def test_favicon
|
82
82
|
assert_no_file 'public/favicon.ico'
|
83
83
|
end
|
84
|
+
|
85
|
+
def test_development_mailer_port
|
86
|
+
assert_file 'config/environments/development.rb' do |file|
|
87
|
+
assert_match(%(config.action_mailer.default_url_options = { port: 3000 }), file)
|
88
|
+
end
|
89
|
+
end
|
84
90
|
end
|
85
91
|
end
|
@@ -21,5 +21,15 @@ module Workarea
|
|
21
21
|
assert_equal([changed_email], changed_mail.from)
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
def test_default_url_options
|
26
|
+
@current_options = Rails.application.config.action_mailer.default_url_options.deep_dup
|
27
|
+
Rails.application.config.action_mailer.default_url_options = { port: 12345 }
|
28
|
+
|
29
|
+
assert_equal(12345, ApplicationMailer.new.default_url_options[:port])
|
30
|
+
|
31
|
+
ensure
|
32
|
+
Rails.application.config.action_mailer.default_url_options = @current_options
|
33
|
+
end
|
24
34
|
end
|
25
35
|
end
|
@@ -51,6 +51,63 @@ module Workarea
|
|
51
51
|
refute_equal(payment_id, checkout.payment.object_id)
|
52
52
|
end
|
53
53
|
|
54
|
+
def test_update
|
55
|
+
create_shipping_service
|
56
|
+
checkout = Checkout.new(@order)
|
57
|
+
|
58
|
+
checkout.start_as(:guest)
|
59
|
+
|
60
|
+
refute(
|
61
|
+
checkout.update(
|
62
|
+
email: 'test@workarea.com',
|
63
|
+
shipping_address: {
|
64
|
+
last_name: 'Crouse',
|
65
|
+
street: '22 S. 3rd St.',
|
66
|
+
street_2: 'Second Floor',
|
67
|
+
city: 'Philadelphia',
|
68
|
+
region: 'PA',
|
69
|
+
postal_code: '19106',
|
70
|
+
country: 'US'
|
71
|
+
},
|
72
|
+
billing_address: {
|
73
|
+
first_name: 'Ben',
|
74
|
+
street: '22 S. 3rd St.',
|
75
|
+
street_2: 'Second Floor',
|
76
|
+
city: 'Philadelphia',
|
77
|
+
region: 'PA',
|
78
|
+
postal_code: '19106',
|
79
|
+
country: 'US'
|
80
|
+
}
|
81
|
+
)
|
82
|
+
)
|
83
|
+
|
84
|
+
assert(
|
85
|
+
checkout.update(
|
86
|
+
email: 'test@workarea.com',
|
87
|
+
shipping_address: {
|
88
|
+
first_name: 'Ben',
|
89
|
+
last_name: 'Crouse',
|
90
|
+
street: '22 S. 3rd St.',
|
91
|
+
street_2: 'Second Floor',
|
92
|
+
city: 'Philadelphia',
|
93
|
+
region: 'PA',
|
94
|
+
postal_code: '19106',
|
95
|
+
country: 'US'
|
96
|
+
},
|
97
|
+
billing_address: {
|
98
|
+
first_name: 'Ben',
|
99
|
+
last_name: 'Crouse',
|
100
|
+
street: '22 S. 3rd St.',
|
101
|
+
street_2: 'Second Floor',
|
102
|
+
city: 'Philadelphia',
|
103
|
+
region: 'PA',
|
104
|
+
postal_code: '19106',
|
105
|
+
country: 'US'
|
106
|
+
}
|
107
|
+
)
|
108
|
+
)
|
109
|
+
end
|
110
|
+
|
54
111
|
def test_continue_as
|
55
112
|
checkout = Checkout.new(@order)
|
56
113
|
checkout.continue_as(@user)
|
@@ -132,6 +132,46 @@ module Workarea
|
|
132
132
|
refute(import.error?)
|
133
133
|
assert(import.successful?)
|
134
134
|
end
|
135
|
+
|
136
|
+
def test_csv_embedded_changes_for_release
|
137
|
+
release = create_release
|
138
|
+
product = create_product(
|
139
|
+
name: 'Foo',
|
140
|
+
variants: [{ sku: '1', name: 'Bar' }, { sku: '2', name: 'Baz' }]
|
141
|
+
)
|
142
|
+
product.name = 'Foo Changed'
|
143
|
+
product.variants.first.name = 'Bar Changed'
|
144
|
+
|
145
|
+
import = create_import(
|
146
|
+
model_type: product.class.name,
|
147
|
+
file: create_tempfile(Csv.new.serialize(product), extension: 'csv'),
|
148
|
+
file_type: 'csv',
|
149
|
+
release_id: release.id
|
150
|
+
)
|
151
|
+
|
152
|
+
assert_equal('csv', import.file_type)
|
153
|
+
assert_nothing_raised { import.process! }
|
154
|
+
|
155
|
+
product.reload
|
156
|
+
assert_equal('Foo', product.name)
|
157
|
+
assert_equal('Bar', product.variants.first.name)
|
158
|
+
assert_equal('Baz', product.variants.second.name)
|
159
|
+
|
160
|
+
Release.with_current(release) do
|
161
|
+
product.reload
|
162
|
+
assert_equal('Foo Changed', product.name)
|
163
|
+
assert_equal('Bar Changed', product.variants.first.name)
|
164
|
+
assert_equal('Baz', product.variants.second.name)
|
165
|
+
end
|
166
|
+
|
167
|
+
import.reload
|
168
|
+
assert_equal(2, import.total)
|
169
|
+
assert_equal(2, import.succeeded)
|
170
|
+
assert_equal(0, import.failed)
|
171
|
+
assert(import.complete?)
|
172
|
+
refute(import.error?)
|
173
|
+
assert(import.successful?)
|
174
|
+
end
|
135
175
|
end
|
136
176
|
end
|
137
177
|
end
|
data/workarea-core.gemspec
CHANGED
@@ -91,7 +91,7 @@ Gem::Specification.new do |s|
|
|
91
91
|
s.add_dependency 'loofah', '~> 2.3.1'
|
92
92
|
s.add_dependency 'referer-parser', '~> 0.3.0'
|
93
93
|
s.add_dependency 'serviceworker-rails', '~> 0.5.5'
|
94
|
-
s.add_dependency 'chartkick', '~> 3.
|
94
|
+
s.add_dependency 'chartkick', '~> 3.4.0'
|
95
95
|
s.add_dependency 'browser', '~> 2.6.1'
|
96
96
|
s.add_dependency 'puma', '>= 4.3.1'
|
97
97
|
s.add_dependency 'rack' , '>= 2.1.4'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workarea-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Crouse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -1100,14 +1100,14 @@ dependencies:
|
|
1100
1100
|
requirements:
|
1101
1101
|
- - "~>"
|
1102
1102
|
- !ruby/object:Gem::Version
|
1103
|
-
version: 3.
|
1103
|
+
version: 3.4.0
|
1104
1104
|
type: :runtime
|
1105
1105
|
prerelease: false
|
1106
1106
|
version_requirements: !ruby/object:Gem::Requirement
|
1107
1107
|
requirements:
|
1108
1108
|
- - "~>"
|
1109
1109
|
- !ruby/object:Gem::Version
|
1110
|
-
version: 3.
|
1110
|
+
version: 3.4.0
|
1111
1111
|
- !ruby/object:Gem::Dependency
|
1112
1112
|
name: browser
|
1113
1113
|
requirement: !ruby/object:Gem::Requirement
|