workarea-gift_wrapping 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +20 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.gitignore +23 -0
- data/CHANGELOG.md +34 -0
- data/CODE_OF_CONDUCT.md +3 -0
- data/CONTRIBUTING.md +3 -0
- data/Gemfile +9 -0
- data/LICENSE +52 -0
- data/README.md +41 -0
- data/Rakefile +60 -0
- data/app/controllers/workarea/admin/catalog_gift_wraps_controller.rb +77 -0
- data/app/models/workarea/catalog/gift_wrap.rb +10 -0
- data/app/models/workarea/catalog/product.decorator +7 -0
- data/app/models/workarea/checkout/steps/shipping.decorator +57 -0
- data/app/models/workarea/order/item.decorator +53 -0
- data/app/models/workarea/pricing/calculators/gift_wrapping_calculator.rb +38 -0
- data/app/models/workarea/pricing/request.decorator +9 -0
- data/app/models/workarea/shipping.decorator +10 -0
- data/app/seeds/workarea/gift_wrapping_seeds.rb +19 -0
- data/app/view_models/workarea/order_item_view_model.decorator +19 -0
- data/app/view_models/workarea/storefront/checkout/gift_options_view_model.rb +45 -0
- data/app/view_models/workarea/storefront/checkout/summary_view_model.decorator +11 -0
- data/app/views/workarea/admin/catalog_gift_wraps/_aux_navigation.html.haml +7 -0
- data/app/views/workarea/admin/catalog_gift_wraps/_navigation.html.haml +1 -0
- data/app/views/workarea/admin/catalog_gift_wraps/edit.html.haml +38 -0
- data/app/views/workarea/admin/catalog_gift_wraps/index.html.haml +41 -0
- data/app/views/workarea/admin/catalog_gift_wraps/new.html.haml +39 -0
- data/app/views/workarea/admin/catalog_products/_gift_wrapping_fields.html.haml +3 -0
- data/app/views/workarea/admin/orders/_gift_wrapping.html.haml +4 -0
- data/app/views/workarea/admin/shippings/_gift_message.html.haml +5 -0
- data/app/views/workarea/storefront/checkouts/_gift_message.html.haml +10 -0
- data/app/views/workarea/storefront/checkouts/_gift_message_summary.html.haml +4 -0
- data/app/views/workarea/storefront/checkouts/_gift_wrapping.html.haml +34 -0
- data/app/views/workarea/storefront/checkouts/_gift_wrapping_summary.html.haml +5 -0
- data/app/views/workarea/storefront/order_mailer/_gift_message.html.haml +8 -0
- data/app/views/workarea/storefront/order_mailer/_gift_message.text.erb +5 -0
- data/app/views/workarea/storefront/order_mailer/_gift_wrapping.html.haml +4 -0
- data/app/views/workarea/storefront/order_mailer/_gift_wrapping.text.erb +3 -0
- data/app/views/workarea/storefront/orders/_gift_message.html.haml +7 -0
- data/app/views/workarea/storefront/orders/_gift_wrapping.html.haml +4 -0
- data/bin/rails +20 -0
- data/config/initializers/appends.rb +68 -0
- data/config/initializers/configuration.rb +15 -0
- data/config/locales/en.yml +42 -0
- data/config/routes.rb +5 -0
- data/lib/workarea/gift_wrapping/engine.rb +22 -0
- data/lib/workarea/gift_wrapping/version.rb +5 -0
- data/lib/workarea/gift_wrapping.rb +11 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +4 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +37 -0
- data/test/dummy/bin/update +29 -0
- data/test/dummy/bin/yarn +11 -0
- data/test/dummy/config/application.rb +27 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +10 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +54 -0
- data/test/dummy/config/environments/production.rb +91 -0
- data/test/dummy/config/environments/test.rb +44 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/test/dummy/config/initializers/assets.rb +14 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/workarea.rb +5 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +33 -0
- data/test/dummy/config/puma.rb +56 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config/secrets.yml +32 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/db/seeds.rb +2 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/factories/workarea/gift_wrapping.rb +21 -0
- data/test/integration/workarea/admin/catalog_gift_wrap_integration_test.rb +50 -0
- data/test/integration/workarea/storefront/gift_wrapping_integration_test.rb +76 -0
- data/test/models/workarea/checkout/steps/gift_wrapping_shipping_test.rb +37 -0
- data/test/models/workarea/order/gift_wrapping_item_test.rb +52 -0
- data/test/models/workarea/pricing/calculators/gift_wrapping_calculator_test.rb +84 -0
- data/test/system/workarea/admin/gift_wrap_system_test.rb +48 -0
- data/test/system/workarea/storefront/gift_wrap_system_test.rb +93 -0
- data/test/teaspoon_env.rb +6 -0
- data/test/test_helper.rb +10 -0
- data/workarea-gift_wrapping.gemspec +21 -0
- metadata +170 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
module Storefront
|
5
|
+
class GiftWrappingIntegrationTest < Workarea::IntegrationTest
|
6
|
+
def test_items_that_cannot_be_gift_wrapped
|
7
|
+
product = create_product(allow_gift_wrapping: false)
|
8
|
+
shipping_service = create_shipping_service
|
9
|
+
gift_wrap = create_gift_wrap
|
10
|
+
|
11
|
+
post storefront.cart_items_path,
|
12
|
+
params: {
|
13
|
+
product_id: product.id,
|
14
|
+
sku: product.skus.first,
|
15
|
+
quantity: 1
|
16
|
+
}
|
17
|
+
|
18
|
+
patch storefront.checkout_addresses_path,
|
19
|
+
params: {
|
20
|
+
email: 'bcrouse@weblinc.com',
|
21
|
+
billing_address: {
|
22
|
+
first_name: 'Ben',
|
23
|
+
last_name: 'Crouse',
|
24
|
+
street: '12 N. 3rd St.',
|
25
|
+
city: 'Philadelphia',
|
26
|
+
region: 'PA',
|
27
|
+
postal_code: '19106',
|
28
|
+
country: 'US',
|
29
|
+
phone_number: '2159251800'
|
30
|
+
},
|
31
|
+
shipping_address: {
|
32
|
+
first_name: 'Ben',
|
33
|
+
last_name: 'Crouse',
|
34
|
+
street: '22 S. 3rd St.',
|
35
|
+
city: 'Philadelphia',
|
36
|
+
region: 'PA',
|
37
|
+
postal_code: '19106',
|
38
|
+
country: 'US',
|
39
|
+
phone_number: '2159251800'
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
get storefront.checkout_shipping_path
|
44
|
+
assert_includes(
|
45
|
+
response.body,
|
46
|
+
t('workarea.storefront.checkouts.gift_wrapping_unavailable')
|
47
|
+
)
|
48
|
+
|
49
|
+
order = Order.first
|
50
|
+
patch storefront.checkout_shipping_path,
|
51
|
+
params: {
|
52
|
+
shipping_service: shipping_service.name,
|
53
|
+
gift_wrapping: { order.items.first.id => { gift_wrap: gift_wrap.id } }
|
54
|
+
}
|
55
|
+
|
56
|
+
get storefront.checkout_payment_path
|
57
|
+
patch storefront.checkout_place_order_path,
|
58
|
+
params: {
|
59
|
+
payment: 'new_card',
|
60
|
+
credit_card: {
|
61
|
+
number: 1,
|
62
|
+
month: 1,
|
63
|
+
year: Time.current.year + 1,
|
64
|
+
cvv: '999'
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
assert_equal(1, Order.placed.count)
|
69
|
+
|
70
|
+
refute(order.reload.items.first.allow_gift_wrapping?)
|
71
|
+
assert(order.items.first.gift_wrap_quantities.blank?)
|
72
|
+
assert(order.items.first.gift_wraps_attributes.blank?)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
class Checkout
|
5
|
+
module Steps
|
6
|
+
class GiftWrappingShippingTest < TestCase
|
7
|
+
def test_update
|
8
|
+
order = create_order(items: [])
|
9
|
+
order.add_item(
|
10
|
+
product_id: '1234',
|
11
|
+
sku: 'SKU',
|
12
|
+
quantity: 2,
|
13
|
+
product_attributes: { allow_gift_wrapping: true }
|
14
|
+
)
|
15
|
+
|
16
|
+
checkout = Checkout.new(order)
|
17
|
+
step = Steps::Shipping.new(checkout)
|
18
|
+
|
19
|
+
gift_wrap = create_gift_wrap(name: 'Simple', sku: 'GW01')
|
20
|
+
|
21
|
+
step.update(
|
22
|
+
gift_message: 'Foo bar',
|
23
|
+
gift_wrapping: {
|
24
|
+
order.items.first.id.to_s => { gift_wrap: gift_wrap.id.to_s }
|
25
|
+
}
|
26
|
+
)
|
27
|
+
|
28
|
+
assert_equal('Foo bar', checkout.shipping.reload.gift_message)
|
29
|
+
|
30
|
+
item = order.reload.items.first
|
31
|
+
assert_equal({ 'GW01' => 2 }, item.gift_wrap_quantities)
|
32
|
+
assert_equal(gift_wrap.id, item.gift_wraps_attributes.first['_id'])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
class Order
|
5
|
+
class GiftWrappingItemTest < TestCase
|
6
|
+
def test_quantity
|
7
|
+
item = Order::Item.new(
|
8
|
+
quantity: 1,
|
9
|
+
gift_wrap_quantities: { 'GW01' => 1 }
|
10
|
+
)
|
11
|
+
|
12
|
+
item.quantity = 3
|
13
|
+
assert_equal(3, item.quantity)
|
14
|
+
assert_equal({ 'GW01' => 3 }, item.gift_wrap_quantities)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_reset_gift_wrapping
|
18
|
+
wrap = create_gift_wrap(name: 'Test', sku: 'GW01')
|
19
|
+
|
20
|
+
item = Order::Item.new(
|
21
|
+
quantity: 2,
|
22
|
+
gift_wrap_quantities: { 'GW01' => 2 },
|
23
|
+
gift_wraps_attributes: [wrap.as_document]
|
24
|
+
)
|
25
|
+
|
26
|
+
item.reset_gift_wrapping
|
27
|
+
assert_empty(item.gift_wrap_quantities)
|
28
|
+
assert_empty(item.gift_wraps_attributes)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_add_gift_wrap
|
32
|
+
wrap = create_gift_wrap(name: 'Test', sku: 'GW01')
|
33
|
+
item = Order::Item.new(quantity: 3)
|
34
|
+
|
35
|
+
item.add_gift_wrap(wrap.as_document, 1)
|
36
|
+
|
37
|
+
assert_equal({ 'GW01' => 1 }, item.gift_wrap_quantities)
|
38
|
+
assert_equal(1, item.gift_wraps_attributes.count)
|
39
|
+
|
40
|
+
item.add_gift_wrap(wrap.as_document)
|
41
|
+
|
42
|
+
assert_equal({ 'GW01' => 3 }, item.gift_wrap_quantities)
|
43
|
+
assert_equal(1, item.gift_wraps_attributes.count)
|
44
|
+
|
45
|
+
item.add_gift_wrap(wrap.as_document, 10)
|
46
|
+
|
47
|
+
assert_equal({ 'GW01' => 3 }, item.gift_wrap_quantities)
|
48
|
+
assert_equal(1, item.gift_wraps_attributes.count)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
module Pricing
|
5
|
+
module Calculators
|
6
|
+
class GiftWrappingCalculatorTest < TestCase
|
7
|
+
setup :setup_gift_wraps
|
8
|
+
|
9
|
+
def setup_gift_wraps
|
10
|
+
create_gift_wrap(name: 'Standard', sku: 'GW1', pricing: { tax_code: '001', prices: [{ regular: 2.to_m }] })
|
11
|
+
create_gift_wrap(name: 'Special', sku: 'GW2', pricing: { tax_code: '002', prices: [{ regular: 1.to_m }] })
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_adjust
|
15
|
+
order = Order.new
|
16
|
+
order.add_item(product_id: 'PRODUCT', sku: 'SKU1', quantity: 2, gift_wrap_quantities: { 'GW1' => 2 })
|
17
|
+
order.add_item(product_id: 'PRODUCT', sku: 'SKU2', quantity: 1, gift_wrap_quantities: { 'GW2' => 1 })
|
18
|
+
|
19
|
+
GiftWrappingCalculator.test_adjust(order)
|
20
|
+
|
21
|
+
assert_equal(1, order.items.first.price_adjustments.length)
|
22
|
+
assert_equal('item', order.items.first.price_adjustments.first.price)
|
23
|
+
assert_equal(4.to_m, order.items.first.price_adjustments.first.amount)
|
24
|
+
assert_equal('001', order.items.first.price_adjustments.first.data['tax_code'])
|
25
|
+
assert_equal(
|
26
|
+
I18n.t('workarea.gift_wrap.price_adjustment'),
|
27
|
+
order.items.first.price_adjustments.first.description
|
28
|
+
)
|
29
|
+
|
30
|
+
assert_equal(1, order.items.second.price_adjustments.length)
|
31
|
+
assert_equal('item', order.items.second.price_adjustments.first.price)
|
32
|
+
assert_equal(1.to_m, order.items.second.price_adjustments.first.amount)
|
33
|
+
assert_equal('002', order.items.second.price_adjustments.first.data['tax_code'])
|
34
|
+
assert_equal(
|
35
|
+
I18n.t('workarea.gift_wrap.price_adjustment'),
|
36
|
+
order.items.second.price_adjustments.first.description
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Note: Orders like this are not possible in the UI, but gift wrapping
|
41
|
+
# is modeled in such a way that it can be done if the interface to build
|
42
|
+
# it was added as a customization.
|
43
|
+
def test_adjust_with_partial_and_mixed_wrappings
|
44
|
+
order = Order.new
|
45
|
+
order.add_item(product_id: 'PRODUCT', sku: 'SKU1', quantity: 3, gift_wrap_quantities: { 'GW1' => 1, 'GW2' => 2 })
|
46
|
+
order.add_item(product_id: 'PRODUCT', sku: 'SKU2', quantity: 2, gift_wrap_quantities: { 'GW2' => 1 })
|
47
|
+
|
48
|
+
GiftWrappingCalculator.test_adjust(order)
|
49
|
+
|
50
|
+
assert_equal(2, order.items.first.price_adjustments.length)
|
51
|
+
|
52
|
+
assert_equal('item', order.items.first.price_adjustments.first.price)
|
53
|
+
assert_equal(1, order.items.first.price_adjustments.first.quantity)
|
54
|
+
assert_equal(2.to_m, order.items.first.price_adjustments.first.amount)
|
55
|
+
assert_equal('001', order.items.first.price_adjustments.first.data['tax_code'])
|
56
|
+
assert_equal(
|
57
|
+
I18n.t('workarea.gift_wrap.price_adjustment'),
|
58
|
+
order.items.first.price_adjustments.first.description
|
59
|
+
)
|
60
|
+
|
61
|
+
assert_equal('item', order.items.first.price_adjustments.second.price)
|
62
|
+
assert_equal(2.to_m, order.items.first.price_adjustments.second.amount)
|
63
|
+
assert_equal(2, order.items.first.price_adjustments.second.quantity)
|
64
|
+
assert_equal('002', order.items.first.price_adjustments.second.data['tax_code'])
|
65
|
+
assert_equal(
|
66
|
+
I18n.t('workarea.gift_wrap.price_adjustment'),
|
67
|
+
order.items.first.price_adjustments.first.description
|
68
|
+
)
|
69
|
+
|
70
|
+
assert_equal(1, order.items.second.price_adjustments.length)
|
71
|
+
|
72
|
+
assert_equal('item', order.items.second.price_adjustments.first.price)
|
73
|
+
assert_equal(1.to_m, order.items.second.price_adjustments.first.amount)
|
74
|
+
assert_equal(1, order.items.second.price_adjustments.first.quantity)
|
75
|
+
assert_equal('002', order.items.second.price_adjustments.first.data['tax_code'])
|
76
|
+
assert_equal(
|
77
|
+
I18n.t('workarea.gift_wrap.price_adjustment'),
|
78
|
+
order.items.second.price_adjustments.first.description
|
79
|
+
)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
module Admin
|
5
|
+
class GiftWrapSystemTest < Workarea::SystemTest
|
6
|
+
include Admin::IntegrationTest
|
7
|
+
|
8
|
+
def test_managing_gift_wraps
|
9
|
+
visit admin.catalog_gift_wraps_path
|
10
|
+
|
11
|
+
click_link t('workarea.admin.catalog_gift_wraps.index.button')
|
12
|
+
|
13
|
+
fill_in 'gift_wrap[name]', with: 'Test'
|
14
|
+
fill_in 'gift_wrap[sku]', with: 'GIFT_WRAP'
|
15
|
+
fill_in 'pricing_sku[regular]', with: '2.50'
|
16
|
+
click_button t('workarea.admin.catalog_gift_wraps.new.button')
|
17
|
+
|
18
|
+
assert(page.has_content?('Success'))
|
19
|
+
assert(page.has_content?('Test'))
|
20
|
+
assert(page.has_content?('GIFT_WRAP'))
|
21
|
+
|
22
|
+
click_link 'Test'
|
23
|
+
|
24
|
+
click_link t('workarea.admin.catalog_gift_wraps.edit.view_pricing')
|
25
|
+
assert_current_path(admin.pricing_sku_path('GIFT_WRAP'))
|
26
|
+
assert(page.has_content?('2.50'))
|
27
|
+
|
28
|
+
visit admin.catalog_gift_wraps_path
|
29
|
+
click_link 'Test'
|
30
|
+
|
31
|
+
fill_in 'gift_wrap[name]', with: 'Fancy'
|
32
|
+
click_button t('workarea.admin.catalog_gift_wraps.edit.button')
|
33
|
+
|
34
|
+
assert(page.has_content?('Success'))
|
35
|
+
assert(page.has_no_content?('Test'))
|
36
|
+
assert(page.has_content?('Fancy'))
|
37
|
+
assert(page.has_content?('GIFT_WRAP'))
|
38
|
+
|
39
|
+
click_link 'Fancy'
|
40
|
+
click_link t('workarea.admin.actions.delete')
|
41
|
+
|
42
|
+
assert(page.has_content?('Success'))
|
43
|
+
assert(page.has_no_content?('Fancy'))
|
44
|
+
assert(page.has_no_content?('GIFT_WRAP'))
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
module Storefront
|
5
|
+
class GiftWrapSystemTest < Workarea::SystemTest
|
6
|
+
include Storefront::SystemTest
|
7
|
+
|
8
|
+
setup :setup_checkout_specs, :setup_gift_wrap, :start_guest_checkout
|
9
|
+
|
10
|
+
def setup_gift_wrap
|
11
|
+
create_gift_wrap(name: 'Standard', sku: 'GW1', pricing: { tax_code: '001', prices: [{ regular: 1.to_m }] })
|
12
|
+
create_gift_wrap(name: 'Special', sku: 'GW2', pricing: { tax_code: '001', prices: [{ regular: 1.5.to_m }] })
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_successfully_checking_out
|
16
|
+
assert_current_path(storefront.checkout_addresses_path)
|
17
|
+
fill_in_email
|
18
|
+
fill_in_shipping_address
|
19
|
+
uncheck 'same_as_shipping'
|
20
|
+
fill_in_billing_address
|
21
|
+
click_button t('workarea.storefront.checkouts.continue_to_shipping')
|
22
|
+
|
23
|
+
assert_current_path(storefront.checkout_shipping_path)
|
24
|
+
assert(page.has_content?('Success'))
|
25
|
+
|
26
|
+
fill_in 'gift_message', with: 'test gift message is here'
|
27
|
+
|
28
|
+
item = Order.last.items.first
|
29
|
+
select 'Special', from: "gift_wrapping[#{item.id}][gift_wrap]"
|
30
|
+
|
31
|
+
click_button t('workarea.storefront.checkouts.continue_to_payment')
|
32
|
+
|
33
|
+
assert_current_path(storefront.checkout_payment_path)
|
34
|
+
assert(page.has_content?('Success'))
|
35
|
+
|
36
|
+
assert(page.has_content?(t('workarea.storefront.checkouts.gift_message')))
|
37
|
+
assert(page.has_content?('test gift message is here'))
|
38
|
+
assert(page.has_content?('Special'))
|
39
|
+
assert(page.has_content?(t('workarea.gift_wrap.price_adjustment')))
|
40
|
+
assert(page.has_content?('$1.50')) # gift wrapping
|
41
|
+
|
42
|
+
assert(page.has_content?('22 S. 3rd St.'))
|
43
|
+
assert(page.has_content?('Philadelphia'))
|
44
|
+
assert(page.has_content?('PA'))
|
45
|
+
assert(page.has_content?('19106'))
|
46
|
+
assert(page.has_content?('Ground'))
|
47
|
+
|
48
|
+
assert(page.has_content?('Integration Product'))
|
49
|
+
assert(page.has_content?('SKU'))
|
50
|
+
|
51
|
+
assert(page.has_content?('$6.50')) # Subtotal
|
52
|
+
assert(page.has_content?('$7.00')) # Shipping
|
53
|
+
assert(page.has_content?('$0.94')) # Tax
|
54
|
+
assert(page.has_content?('$14.44')) # Total
|
55
|
+
|
56
|
+
fill_in_credit_card
|
57
|
+
click_button t('workarea.storefront.checkouts.place_order')
|
58
|
+
|
59
|
+
assert_current_path(storefront.checkout_confirmation_path)
|
60
|
+
|
61
|
+
assert(page.has_content?('Success'))
|
62
|
+
assert(page.has_content?(t('workarea.storefront.flash_messages.order_placed')))
|
63
|
+
assert(page.has_content?(Order.first.id))
|
64
|
+
|
65
|
+
assert(page.has_content?('22 S. 3rd St.'))
|
66
|
+
assert(page.has_content?('Philadelphia'))
|
67
|
+
assert(page.has_content?('PA'))
|
68
|
+
assert(page.has_content?('19106'))
|
69
|
+
assert(page.has_content?('Ground'))
|
70
|
+
|
71
|
+
assert(page.has_content?('1019 S. 47th St.'))
|
72
|
+
assert(page.has_content?('Philadelphia'))
|
73
|
+
assert(page.has_content?('PA'))
|
74
|
+
assert(page.has_content?('19143'))
|
75
|
+
|
76
|
+
assert(page.has_content?('Test Card'))
|
77
|
+
assert(page.has_content?('XX-1'))
|
78
|
+
|
79
|
+
assert(page.has_content?('Integration Product'))
|
80
|
+
assert(page.has_content?('SKU'))
|
81
|
+
|
82
|
+
assert(page.has_content?(t('workarea.storefront.checkouts.gift_message')))
|
83
|
+
assert(page.has_content?('test gift message is here'))
|
84
|
+
assert(page.has_content?('Special'))
|
85
|
+
|
86
|
+
assert(page.has_content?('$6.50')) # Subtotal
|
87
|
+
assert(page.has_content?('$7.00')) # Shipping
|
88
|
+
assert(page.has_content?('$0.94')) # Tax
|
89
|
+
assert(page.has_content?('$14.44')) # Total
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV['RAILS_ENV'] = 'test'
|
3
|
+
|
4
|
+
require File.expand_path('../../test/dummy/config/environment.rb', __FILE__)
|
5
|
+
require 'rails/test_help'
|
6
|
+
require 'workarea/test_help'
|
7
|
+
|
8
|
+
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
9
|
+
# to be shown.
|
10
|
+
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
@@ -0,0 +1,21 @@
|
|
1
|
+
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require 'workarea/gift_wrapping/version'
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'workarea-gift_wrapping'
|
9
|
+
s.version = Workarea::GiftWrapping::VERSION
|
10
|
+
s.authors = ['Matt Duffy']
|
11
|
+
s.email = ['mduffy@workarea.com']
|
12
|
+
s.homepage = 'https://github.com/workarea-commerce/workarea-gift-wrapping'
|
13
|
+
s.summary = 'Gift wrapping plugin for the Workarea Commerce Platform'
|
14
|
+
s.description = 'Workarea Commerce Platform plugin that provides Gift message and wrapping options during checkout.'
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
|
18
|
+
s.license = 'Business Software License'
|
19
|
+
|
20
|
+
s.add_dependency 'workarea', '~> 3.x', '>= 3.2.x'
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: workarea-gift_wrapping
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matt Duffy
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-08-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: workarea
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.x
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.2.x
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.x
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.2.x
|
33
|
+
description: Workarea Commerce Platform plugin that provides Gift message and wrapping
|
34
|
+
options during checkout.
|
35
|
+
email:
|
36
|
+
- mduffy@workarea.com
|
37
|
+
executables: []
|
38
|
+
extensions: []
|
39
|
+
extra_rdoc_files: []
|
40
|
+
files:
|
41
|
+
- ".editorconfig"
|
42
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
43
|
+
- ".github/ISSUE_TEMPLATE/documentation-request.md"
|
44
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
45
|
+
- ".gitignore"
|
46
|
+
- CHANGELOG.md
|
47
|
+
- CODE_OF_CONDUCT.md
|
48
|
+
- CONTRIBUTING.md
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- app/controllers/workarea/admin/catalog_gift_wraps_controller.rb
|
54
|
+
- app/models/workarea/catalog/gift_wrap.rb
|
55
|
+
- app/models/workarea/catalog/product.decorator
|
56
|
+
- app/models/workarea/checkout/steps/shipping.decorator
|
57
|
+
- app/models/workarea/order/item.decorator
|
58
|
+
- app/models/workarea/pricing/calculators/gift_wrapping_calculator.rb
|
59
|
+
- app/models/workarea/pricing/request.decorator
|
60
|
+
- app/models/workarea/shipping.decorator
|
61
|
+
- app/seeds/workarea/gift_wrapping_seeds.rb
|
62
|
+
- app/view_models/workarea/order_item_view_model.decorator
|
63
|
+
- app/view_models/workarea/storefront/checkout/gift_options_view_model.rb
|
64
|
+
- app/view_models/workarea/storefront/checkout/summary_view_model.decorator
|
65
|
+
- app/views/workarea/admin/catalog_gift_wraps/_aux_navigation.html.haml
|
66
|
+
- app/views/workarea/admin/catalog_gift_wraps/_navigation.html.haml
|
67
|
+
- app/views/workarea/admin/catalog_gift_wraps/edit.html.haml
|
68
|
+
- app/views/workarea/admin/catalog_gift_wraps/index.html.haml
|
69
|
+
- app/views/workarea/admin/catalog_gift_wraps/new.html.haml
|
70
|
+
- app/views/workarea/admin/catalog_products/_gift_wrapping_fields.html.haml
|
71
|
+
- app/views/workarea/admin/orders/_gift_wrapping.html.haml
|
72
|
+
- app/views/workarea/admin/shippings/_gift_message.html.haml
|
73
|
+
- app/views/workarea/storefront/checkouts/_gift_message.html.haml
|
74
|
+
- app/views/workarea/storefront/checkouts/_gift_message_summary.html.haml
|
75
|
+
- app/views/workarea/storefront/checkouts/_gift_wrapping.html.haml
|
76
|
+
- app/views/workarea/storefront/checkouts/_gift_wrapping_summary.html.haml
|
77
|
+
- app/views/workarea/storefront/order_mailer/_gift_message.html.haml
|
78
|
+
- app/views/workarea/storefront/order_mailer/_gift_message.text.erb
|
79
|
+
- app/views/workarea/storefront/order_mailer/_gift_wrapping.html.haml
|
80
|
+
- app/views/workarea/storefront/order_mailer/_gift_wrapping.text.erb
|
81
|
+
- app/views/workarea/storefront/orders/_gift_message.html.haml
|
82
|
+
- app/views/workarea/storefront/orders/_gift_wrapping.html.haml
|
83
|
+
- bin/rails
|
84
|
+
- config/initializers/appends.rb
|
85
|
+
- config/initializers/configuration.rb
|
86
|
+
- config/locales/en.yml
|
87
|
+
- config/routes.rb
|
88
|
+
- lib/workarea/gift_wrapping.rb
|
89
|
+
- lib/workarea/gift_wrapping/engine.rb
|
90
|
+
- lib/workarea/gift_wrapping/version.rb
|
91
|
+
- test/dummy/Rakefile
|
92
|
+
- test/dummy/app/assets/config/manifest.js
|
93
|
+
- test/dummy/app/assets/images/.keep
|
94
|
+
- test/dummy/app/assets/javascripts/application.js
|
95
|
+
- test/dummy/app/assets/stylesheets/application.css
|
96
|
+
- test/dummy/app/controllers/application_controller.rb
|
97
|
+
- test/dummy/app/controllers/concerns/.keep
|
98
|
+
- test/dummy/app/helpers/application_helper.rb
|
99
|
+
- test/dummy/app/jobs/application_job.rb
|
100
|
+
- test/dummy/app/mailers/application_mailer.rb
|
101
|
+
- test/dummy/app/models/concerns/.keep
|
102
|
+
- test/dummy/app/views/layouts/application.html.erb
|
103
|
+
- test/dummy/app/views/layouts/mailer.html.erb
|
104
|
+
- test/dummy/app/views/layouts/mailer.text.erb
|
105
|
+
- test/dummy/bin/bundle
|
106
|
+
- test/dummy/bin/rails
|
107
|
+
- test/dummy/bin/rake
|
108
|
+
- test/dummy/bin/setup
|
109
|
+
- test/dummy/bin/update
|
110
|
+
- test/dummy/bin/yarn
|
111
|
+
- test/dummy/config.ru
|
112
|
+
- test/dummy/config/application.rb
|
113
|
+
- test/dummy/config/boot.rb
|
114
|
+
- test/dummy/config/cable.yml
|
115
|
+
- test/dummy/config/environment.rb
|
116
|
+
- test/dummy/config/environments/development.rb
|
117
|
+
- test/dummy/config/environments/production.rb
|
118
|
+
- test/dummy/config/environments/test.rb
|
119
|
+
- test/dummy/config/initializers/application_controller_renderer.rb
|
120
|
+
- test/dummy/config/initializers/assets.rb
|
121
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
122
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
123
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
124
|
+
- test/dummy/config/initializers/inflections.rb
|
125
|
+
- test/dummy/config/initializers/mime_types.rb
|
126
|
+
- test/dummy/config/initializers/workarea.rb
|
127
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
128
|
+
- test/dummy/config/locales/en.yml
|
129
|
+
- test/dummy/config/puma.rb
|
130
|
+
- test/dummy/config/routes.rb
|
131
|
+
- test/dummy/config/secrets.yml
|
132
|
+
- test/dummy/config/spring.rb
|
133
|
+
- test/dummy/db/seeds.rb
|
134
|
+
- test/dummy/lib/assets/.keep
|
135
|
+
- test/dummy/log/.keep
|
136
|
+
- test/factories/workarea/gift_wrapping.rb
|
137
|
+
- test/integration/workarea/admin/catalog_gift_wrap_integration_test.rb
|
138
|
+
- test/integration/workarea/storefront/gift_wrapping_integration_test.rb
|
139
|
+
- test/models/workarea/checkout/steps/gift_wrapping_shipping_test.rb
|
140
|
+
- test/models/workarea/order/gift_wrapping_item_test.rb
|
141
|
+
- test/models/workarea/pricing/calculators/gift_wrapping_calculator_test.rb
|
142
|
+
- test/system/workarea/admin/gift_wrap_system_test.rb
|
143
|
+
- test/system/workarea/storefront/gift_wrap_system_test.rb
|
144
|
+
- test/teaspoon_env.rb
|
145
|
+
- test/test_helper.rb
|
146
|
+
- workarea-gift_wrapping.gemspec
|
147
|
+
homepage: https://github.com/workarea-commerce/workarea-gift-wrapping
|
148
|
+
licenses:
|
149
|
+
- Business Software License
|
150
|
+
metadata: {}
|
151
|
+
post_install_message:
|
152
|
+
rdoc_options: []
|
153
|
+
require_paths:
|
154
|
+
- lib
|
155
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
requirements: []
|
166
|
+
rubygems_version: 3.0.4
|
167
|
+
signing_key:
|
168
|
+
specification_version: 4
|
169
|
+
summary: Gift wrapping plugin for the Workarea Commerce Platform
|
170
|
+
test_files: []
|