spree_recurring_order 2.1.8 → 2.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/spree/admin/recurring_emails_controller.rb +13 -0
- data/app/mailers/spree/order_mailer_decorator.rb +7 -0
- data/app/models/spree/order_decorator.rb +6 -0
- data/app/overrides/add_send_email_button.rb +5 -0
- data/app/views/spree/admin/orders/_send_recurring_email_button.haml +2 -0
- data/config/routes.rb +1 -0
- data/spec/controllers/spree/admin/recurring_emails_controller_spec.rb +36 -0
- data/spec/models/spree/order_spec.rb +24 -0
- data/spree_recurring_order.gemspec +2 -1
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0aa16ab77053b1ed94b81dc7532c4a5d7c5a7de
|
4
|
+
data.tar.gz: 70eb179a5bf2e16ce3479d28562abbe47d62f372
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a17b1eb9833aec91732a3271bb8fd5b9088b39f1e7f1787750125ed38edb90ca08a43d05d1d6ac3862025523abaef73772817f1c236c0959aa82b72e87a1dc50
|
7
|
+
data.tar.gz: 0a560af713ca32907fcc47aab6b425cbb9e6706df5420ca1027fde1c406e91c1d093cd00207fb034d70924ee90cbe2443d22265c66ec1b678d69283d114c2ba0
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Spree
|
2
|
+
module Admin
|
3
|
+
class RecurringEmailsController < Spree::Admin::BaseController
|
4
|
+
|
5
|
+
def create
|
6
|
+
order = Spree::Order.find_by(number: params[:number])
|
7
|
+
order.deliver_recurring_order_email
|
8
|
+
redirect_to(edit_admin_order_path(order))
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/config/routes.rb
CHANGED
@@ -5,4 +5,5 @@ Spree::Core::Engine.routes.draw do
|
|
5
5
|
|
6
6
|
get "admin/recurring_orders/", controller: 'admin/recurring_orders', action: 'index', as: 'admin_recurring_orders'
|
7
7
|
get "admin/recurring_orders/:number", controller: 'admin/recurring_orders', action: 'show', as: 'admin_recurring_order'
|
8
|
+
post "admin/recurring_emails/:number", controller: 'admin/recurring_emails', action: 'create', as: 'admin_recurring_email'
|
8
9
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Spree::Admin::RecurringEmailsController do
|
4
|
+
|
5
|
+
let(:user) { mock_model Spree::User, :last_incomplete_spree_order => nil, :has_spree_role? => true, :spree_api_key => 'fake' }
|
6
|
+
|
7
|
+
before :each do
|
8
|
+
controller.stub :spree_current_user => user
|
9
|
+
controller.stub :check_authorization
|
10
|
+
end
|
11
|
+
|
12
|
+
describe 'create' do
|
13
|
+
|
14
|
+
let(:order){ Spree::Order.new }
|
15
|
+
|
16
|
+
before :each do
|
17
|
+
order.stub(:number).and_return("G1234")
|
18
|
+
order.stub(:id).and_return("1")
|
19
|
+
Spree::Order.stub(:find_by).and_return(order)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should send email' do
|
23
|
+
Spree::Order.should_receive(:find_by).with(number: "G1234").and_return(order)
|
24
|
+
order.should_receive(:deliver_recurring_order_email)
|
25
|
+
|
26
|
+
spree_post :create, { number: 'G1234' }
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should redirect order page' do
|
30
|
+
spree_post :create, { number: 'G1234' }
|
31
|
+
response.should redirect_to('/admin/orders/G1234/edit')
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -17,4 +17,28 @@ describe Spree::Order do
|
|
17
17
|
|
18
18
|
end
|
19
19
|
|
20
|
+
describe 'deliver recurring order email' do
|
21
|
+
|
22
|
+
it 'should not deliver anything if order is not recurring' do
|
23
|
+
order = Spree::Order.new
|
24
|
+
order.stub(:recurring?).and_return false
|
25
|
+
order.deliver_recurring_order_email
|
26
|
+
|
27
|
+
Spree::OrderMailer.should_not_receive(:recurring_email)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should deliver if order is recurring' do
|
31
|
+
order = Spree::Order.new
|
32
|
+
order.stub(:id).and_return 2
|
33
|
+
order.stub(:recurring?).and_return true
|
34
|
+
|
35
|
+
mail = double(Object)
|
36
|
+
Spree::OrderMailer.should_receive(:recurring_email).with(2).and_return(mail)
|
37
|
+
mail.should_receive(:deliver)
|
38
|
+
|
39
|
+
order.deliver_recurring_order_email
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
20
44
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.platform = Gem::Platform::RUBY
|
4
4
|
s.name = 'spree_recurring_order'
|
5
|
-
s.version = '2.1.
|
5
|
+
s.version = '2.1.9'
|
6
6
|
s.summary = 'Add the option to create a recurring order'
|
7
7
|
s.description = ''
|
8
8
|
s.required_ruby_version = '>= 2.0.0'
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.add_dependency 'spree_core', '~> 2.1.3'
|
20
20
|
|
21
21
|
s.add_runtime_dependency 'haml'
|
22
|
+
s.add_runtime_dependency 'delayed_job_active_record'
|
22
23
|
|
23
24
|
s.add_development_dependency 'capybara', '~> 2.1'
|
24
25
|
s.add_development_dependency 'coffee-rails'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_recurring_order
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.9
|
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-
|
11
|
+
date: 2014-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree_core
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: delayed_job_active_record
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: capybara
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -196,14 +210,18 @@ files:
|
|
196
210
|
- app/assets/stylesheets/admin/spree_recurring_order.css
|
197
211
|
- app/assets/stylesheets/store/checkout.css
|
198
212
|
- app/assets/stylesheets/store/spree_recurring_order.css
|
213
|
+
- app/controllers/spree/admin/recurring_emails_controller.rb
|
199
214
|
- app/controllers/spree/admin/recurring_orders_controller.rb
|
200
215
|
- app/controllers/spree/orders_controller_decorator.rb
|
201
216
|
- app/controllers/spree/recurring_orders_controller.rb
|
217
|
+
- app/mailers/spree/order_mailer_decorator.rb
|
202
218
|
- app/models/spree/order_decorator.rb
|
203
219
|
- app/models/spree/recurring_order.rb
|
204
220
|
- app/overrides/add_message_to_checkout.rb
|
221
|
+
- app/overrides/add_send_email_button.rb
|
205
222
|
- app/overrides/add_tab_to_admin_menu.rb
|
206
223
|
- app/overrides/replace_shopping_cart_checkout.rb
|
224
|
+
- app/views/spree/admin/orders/_send_recurring_email_button.haml
|
207
225
|
- app/views/spree/admin/recurring_orders/index.html.erb
|
208
226
|
- app/views/spree/admin/recurring_orders/show.html.erb
|
209
227
|
- app/views/spree/admin/shared/_recurring_orders_tab.html.erb
|
@@ -220,6 +238,7 @@ files:
|
|
220
238
|
- lib/spree_recurring_order.rb
|
221
239
|
- lib/spree_recurring_order/engine.rb
|
222
240
|
- lib/spree_recurring_order/factories.rb
|
241
|
+
- spec/controllers/spree/admin/recurring_emails_controller_spec.rb
|
223
242
|
- spec/controllers/spree/admin/recurring_orders_controller_spec.rb
|
224
243
|
- spec/controllers/spree/orders_controller_spec.rb
|
225
244
|
- spec/controllers/spree/recurring_order_controller_spec.rb
|
@@ -252,6 +271,7 @@ signing_key:
|
|
252
271
|
specification_version: 4
|
253
272
|
summary: Add the option to create a recurring order
|
254
273
|
test_files:
|
274
|
+
- spec/controllers/spree/admin/recurring_emails_controller_spec.rb
|
255
275
|
- spec/controllers/spree/admin/recurring_orders_controller_spec.rb
|
256
276
|
- spec/controllers/spree/orders_controller_spec.rb
|
257
277
|
- spec/controllers/spree/recurring_order_controller_spec.rb
|