spree_repeat_order 2.1.7 → 2.1.8
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57184e323e58d8638e9bdaa9a19b70cff0bf56cc
|
4
|
+
data.tar.gz: c03f7fcf6042f94310e9b4adf7b8e7ae556aef6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03d37c679d485b77231ad435d46a6d3819307b4d5575d0c197788c3ea4e6cc447d65b2a1a8e9b2b2590eb63d0d22db97466706e0f5e6bf7e44a3f3e6f7446b08
|
7
|
+
data.tar.gz: 1f6c9ab54b52050e975c974e3ac049d55f49b053408a9601d44883adb0624497e4d0de205db35c0df9153f6095cb61f754cb028cc2ed53c4fee5e0f6541878d4
|
@@ -13,7 +13,8 @@ module Spree
|
|
13
13
|
|
14
14
|
success = true
|
15
15
|
success = success && !past_order.completed_at.blank?
|
16
|
-
success = success && new_order.
|
16
|
+
success = success && new_order.generate_order_number #forcing number generation since we are skipping validation
|
17
|
+
success = success && new_order.save(validate: false)
|
17
18
|
success = success && merge_with_current_order(new_order)
|
18
19
|
|
19
20
|
if success
|
@@ -21,7 +22,7 @@ module Spree
|
|
21
22
|
redirect_to(admin_orders_path)
|
22
23
|
else
|
23
24
|
flash[:error] = 'Oops.. something went wrong and the order could not be duplicated'
|
24
|
-
redirect_to(
|
25
|
+
redirect_to(edit_admin_order_path(past_order.number))
|
25
26
|
end
|
26
27
|
|
27
28
|
end
|
@@ -33,7 +34,7 @@ module Spree
|
|
33
34
|
|
34
35
|
user_last_incomplete_order = user.last_incomplete_spree_order
|
35
36
|
new_order.merge!(user_last_incomplete_order, user) if user_last_incomplete_order
|
36
|
-
new_order.save
|
37
|
+
new_order.save(validate: false)
|
37
38
|
end
|
38
39
|
|
39
40
|
def duplicate_address(past_order, new_order)
|
@@ -51,6 +51,17 @@ describe Spree::Admin::RepeatedOrdersController do
|
|
51
51
|
response.should be_redirect
|
52
52
|
end
|
53
53
|
|
54
|
+
it 'should skip validation and force number generation' do
|
55
|
+
Spree::Order.should_receive(:find_by).with(number: 'ABC1').and_return(past_order)
|
56
|
+
Spree::Order.stub(:new).and_return(new_order)
|
57
|
+
|
58
|
+
new_order.should_receive(:generate_order_number).and_return(true)
|
59
|
+
new_order.should_receive(:save).with(validate: false).and_return(true)
|
60
|
+
|
61
|
+
spree_post :create, number: "ABC1"
|
62
|
+
response.should be_redirect
|
63
|
+
end
|
64
|
+
|
54
65
|
it 'should skip items that dont exist or are not available' do
|
55
66
|
Spree::Order.should_receive(:find_by).with(number: 'ABC1').and_return(past_order)
|
56
67
|
Spree::Order.stub(:new).and_return(new_order)
|
@@ -85,7 +96,7 @@ describe Spree::Admin::RepeatedOrdersController do
|
|
85
96
|
past_order.stub(:completed_at).and_return nil
|
86
97
|
|
87
98
|
spree_post :create, number: "ABC1"
|
88
|
-
response.should redirect_to('/admin/orders/ABC1')
|
99
|
+
response.should redirect_to('/admin/orders/ABC1/edit')
|
89
100
|
end
|
90
101
|
|
91
102
|
describe 'merging with current order' do
|
data/spree_repeat_order.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.platform = Gem::Platform::RUBY
|
4
4
|
s.name = 'spree_repeat_order'
|
5
|
-
s.version = '2.1.
|
5
|
+
s.version = '2.1.8'
|
6
6
|
s.summary = 'Makes it possible to repeat an existing order with one click'
|
7
7
|
s.description = ''
|
8
8
|
s.required_ruby_version = '>= 2.0.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_repeat_order
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francisco Trindade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree_core
|