spree_repeat_order 2.1.4 → 2.1.5

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: 1815b7096b2cd1a23e03de1c5303c3cb60e9bfa3
4
- data.tar.gz: 1e349b1cbbc4309cb1325bacf54f3bb13cbcf299
3
+ metadata.gz: 4272177e4ab193ae6d44bbe06734a7a64ef71720
4
+ data.tar.gz: a4d9315577742e88f62b8171297552dd61ba2a48
5
5
  SHA512:
6
- metadata.gz: 9f2e01ca1f2f9109e5b1f41feb5c111198a1bdc58c9dc478afd8c3a61428c672e396420eacad092dc048c66efa83b07b69388e989e5bfbcfca9d5dead55d6af3
7
- data.tar.gz: 6622583e85f00b6de6d61db5924633ceafcbc34e1856ccd53d93ed331d840effb15bda9698fa1ddc13fef69e9412a83caaa2f904d7e94217547f9c0098e4c04a
6
+ metadata.gz: ac636e5983be435046974a61e8722bed2c6761a295f669fcac6ec29daaa5cc279cdea570942696ef610e5ac9fab7672f3aba3819ca30a371aac4ab20930a7211
7
+ data.tar.gz: e1fc4334270edbd24cb02a32d22c7c4bf8988b5eaa1e8c54f0c0ef8d22cd4aa1d0f4abd37ba992b4990a3e8d1b36fbf678122714e937d7e2064a122d55e9cd52
@@ -8,7 +8,13 @@ module Spree
8
8
 
9
9
  duplicate_order(past_order, new_order)
10
10
 
11
- if past_order.completed_at && new_order.save
11
+ success = true
12
+ success = success && !past_order.completed_at.blank?
13
+ success = success && new_order.save
14
+ success = success && new_order.next #ADDRESS
15
+ success = success && new_order.next #DELIVERY
16
+
17
+ if success
12
18
  flash[:success] = "The order has been duplicated. The new order id is #{new_order.number}"
13
19
  redirect_to(admin_orders_path)
14
20
  else
@@ -21,6 +27,8 @@ module Spree
21
27
  private
22
28
 
23
29
  def duplicate_order(past_order, new_order)
30
+ new_order.email = past_order.email
31
+
24
32
  new_line_items = []
25
33
  past_order.line_items.each do |line_item|
26
34
  new_line_items << line_item.dup
@@ -78,17 +78,18 @@ describe Spree::Admin::RepeatedOrdersController do
78
78
  it 'should create new order with same line items' do
79
79
  ship_address = FactoryGirl.create(:address)
80
80
  bill_address = FactoryGirl.create(:address)
81
- past_order = FactoryGirl.create(:order, ship_address: ship_address, bill_address: bill_address)
82
- line_item = FactoryGirl.create(:line_item, order: past_order)
81
+ past_order = FactoryGirl.create(:completed_order_with_totals, ship_address: ship_address, bill_address: bill_address)
83
82
 
84
83
  spree_post :create, number: past_order.number
84
+ response.should redirect_to('/admin/orders')
85
85
 
86
86
  last_order = Spree::Order.last
87
- last_order.line_items.count.should == 1
87
+ last_order.line_items.count.should == past_order.line_items.count
88
+ last_order.state.should == 'delivery'
89
+ last_order.ship_address.firstname = past_order.ship_address.firstname
90
+ last_order.bill_address.firstname = past_order.bill_address.firstname
88
91
  end
89
92
 
90
- it 'should save order in delivery state'
91
-
92
93
  end
93
94
 
94
95
 
@@ -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.4'
5
+ s.version = '2.1.5'
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
4
+ version: 2.1.5
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-02-10 00:00:00.000000000 Z
11
+ date: 2014-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_core