solidus_virtual_gift_card 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +35 -0
  3. data/Gemfile +20 -6
  4. data/README.md +4 -3
  5. data/Rakefile +2 -2
  6. data/app/controllers/spree/admin/gift_cards_controller.rb +14 -14
  7. data/app/controllers/spree/api/gift_cards_controller.rb +2 -2
  8. data/app/decorators/models/solidus_virtual_gift_card/spree/inventory_unit_decorator.rb +13 -0
  9. data/app/decorators/models/solidus_virtual_gift_card/spree/line_item_decorator.rb +24 -0
  10. data/app/{models/concerns/spree/gift_cards/order_contents_concerns.rb → decorators/models/solidus_virtual_gift_card/spree/order_contents_decorator.rb} +14 -20
  11. data/app/{models/concerns/spree/gift_cards/order_concerns.rb → decorators/models/solidus_virtual_gift_card/spree/order_decorator.rb} +14 -14
  12. data/app/{models → decorators/models/solidus_virtual_gift_card}/spree/store_credit_category_decorator.rb +1 -1
  13. data/app/mailers/spree/gift_card_mailer.rb +5 -2
  14. data/app/models/spree/gift_cards/gift_card_date_format_error.rb +6 -0
  15. data/app/models/{concerns/spree → spree}/redemption_code_generator.rb +0 -0
  16. data/app/models/spree/virtual_gift_card.rb +19 -16
  17. data/app/overrides/admin_gift_card_order_confirmation.rb +4 -4
  18. data/app/overrides/admin_item_view_gift_card_codes.rb +12 -12
  19. data/app/overrides/admin_user_sidebar_store_credits.rb +3 -3
  20. data/app/overrides/admin_user_sub_menu.rb +2 -2
  21. data/app/views/spree/admin/gift_cards/_lookup_form.html.erb +2 -2
  22. data/app/views/spree/admin/gift_cards/_redemption_form.html.erb +1 -1
  23. data/app/views/spree/admin/gift_cards/edit.html.erb +5 -5
  24. data/app/views/spree/admin/gift_cards/index.html.erb +1 -1
  25. data/app/views/spree/admin/gift_cards/lookup.html.erb +1 -1
  26. data/app/views/spree/admin/orders/_confirmation_gift_card_details.html.erb +9 -9
  27. data/app/views/spree/admin/orders/_gift_card_details.html.erb +2 -2
  28. data/app/views/spree/admin/users/_gift_card_sidebar.html.erb +2 -2
  29. data/app/views/spree/gift_card_mailer/gift_card_email.text.erb +3 -3
  30. data/config/initializers/line_item_controller_gift_card_details.rb +1 -1
  31. data/db/migrate/20140623152903_create_virtual_gift_card.rb +1 -1
  32. data/db/migrate/20140624175113_seed_gift_card_category.rb +1 -1
  33. data/db/migrate/20140627185148_add_timestamps_to_gift_cards.rb +1 -1
  34. data/db/migrate/20140702153907_add_gift_card_flag_to_products.rb +1 -1
  35. data/db/migrate/20140707200431_add_line_item_to_gift_card.rb +1 -1
  36. data/db/migrate/20151013172931_add_recipient_fields_to_virtual_gift_card.rb +1 -1
  37. data/db/migrate/20151013210615_add_active_flag_to_virtual_gift_card.rb +1 -1
  38. data/db/migrate/20151013214647_set_redeemable_true_on_virtual_gift_cards.rb +2 -2
  39. data/db/migrate/20151019190731_add_email_send_time_to_virtual_gift_card.rb +1 -1
  40. data/db/migrate/20151109202300_add_deactivated_at_to_gift_card.rb +1 -1
  41. data/db/migrate/20151110202752_add_inventory_unit_to_gift_card.rb +1 -1
  42. data/db/migrate/20151111211220_backfill_inventory_units_on_gift_card.rb +2 -2
  43. data/lib/generators/solidus_virtual_gift_card/install/install_generator.rb +1 -1
  44. data/lib/solidus_virtual_gift_card.rb +1 -0
  45. data/lib/spree_virtual_gift_card/engine.rb +3 -3
  46. data/lib/spree_virtual_gift_card/factories.rb +7 -7
  47. data/lib/tasks/send_gift_card_emails.rake +1 -1
  48. data/solidus_virtual_gift_card.gemspec +23 -21
  49. data/spec/controllers/spree/admin/gift_cards_controller_spec.rb +33 -34
  50. data/spec/controllers/spree/api/gift_cards_controller_spec.rb +12 -13
  51. data/spec/features/admin/gift_cards_spec.rb +19 -17
  52. data/spec/features/admin/products_card_spec.rb +3 -3
  53. data/spec/lib/tasks/send_gift_card_emails_spec.rb +12 -12
  54. data/spec/mailers/spree/gift_card_mailer_spec.rb +4 -4
  55. data/spec/models/concerns/spree/redemption_code_generator_spec.rb +5 -5
  56. data/spec/models/spree/line_item_spec.rb +2 -2
  57. data/spec/models/spree/order_contents_spec.rb +82 -82
  58. data/spec/models/spree/order_spec.rb +13 -13
  59. data/spec/models/spree/permission_sets/virtual_gift_card_display_spec.rb +2 -2
  60. data/spec/models/spree/permission_sets/virtual_gift_card_management_spec.rb +2 -2
  61. data/spec/models/spree/store_credit_category_spec.rb +6 -6
  62. data/spec/models/spree/virtual_gift_card_spec.rb +23 -23
  63. data/spec/spec_helper.rb +13 -74
  64. data/spec/support/cancan.rb +3 -0
  65. metadata +56 -25
  66. data/.travis.yml +0 -8
  67. data/app/models/concerns/spree/gift_cards/inventory_unit_concerns.rb +0 -10
  68. data/app/models/concerns/spree/gift_cards/line_item_concerns.rb +0 -22
  69. data/app/models/spree/inventory_unit_decorator.rb +0 -1
  70. data/app/models/spree/line_item_decorator.rb +0 -1
  71. data/app/models/spree/order_contents_decorator.rb +0 -1
  72. data/app/models/spree/order_decorator.rb +0 -1
  73. data/circle.yml +0 -6
@@ -3,24 +3,24 @@ require 'spec_helper'
3
3
  describe Spree::Admin::GiftCardsController do
4
4
  stub_authorization!
5
5
  let!(:gc_category) { create(:store_credit_gift_card_category) }
6
- let!(:credit_type) { create(:secondary_credit_type, name: "Non-expiring") }
6
+ let!(:credit_type) { create(:secondary_credit_type, name: 'Non-expiring') }
7
7
 
8
8
  describe 'GET index' do
9
- subject { spree_get :index }
9
+ subject { get :index }
10
10
 
11
- it "returns a 200 status code" do
11
+ it 'returns a 200 status code' do
12
12
  subject
13
- expect(response.code).to eq "200"
13
+ expect(response.code).to eq '200'
14
14
  end
15
15
  end
16
16
 
17
17
  describe 'GET lookup' do
18
18
  let(:user) { create :user }
19
- subject { spree_get :lookup, user_id: user.id }
19
+ subject { get :lookup, params: { user_id: user.id } }
20
20
 
21
- it "returns a 200 status code" do
21
+ it 'returns a 200 status code' do
22
22
  subject
23
- expect(response.code).to eq "200"
23
+ expect(response.code).to eq '200'
24
24
  end
25
25
  end
26
26
 
@@ -30,52 +30,52 @@ describe Spree::Admin::GiftCardsController do
30
30
  let(:order) { create(:shipped_order, line_items_count: 1) }
31
31
  let!(:default_refund_reason) { Spree::RefundReason.find_or_create_by!(name: Spree::RefundReason::RETURN_PROCESSING_REASON, mutable: false) }
32
32
 
33
- subject { spree_put :deactivate, id: gift_card.id, order_id: order.number }
33
+ subject { put :deactivate, params: { id: gift_card.id, order_id: order.number } }
34
34
 
35
- context "when successful" do
36
- it "redirects to the admin order edit page" do
35
+ context 'when successful' do
36
+ it 'redirects to the admin order edit page' do
37
37
  expect(subject).to redirect_to spree.edit_admin_order_path(order)
38
38
  end
39
39
 
40
- it "deactivates the gift card" do
40
+ it 'deactivates the gift card' do
41
41
  subject
42
42
  expect(gift_card.reload.deactivated_at).to be_present
43
43
  end
44
44
  end
45
45
 
46
- context "when deactivating fails without raising an exception" do
46
+ context 'when deactivating fails without raising an exception' do
47
47
  before { expect_any_instance_of(Spree::VirtualGiftCard).to receive(:deactivate).and_return(false) }
48
48
 
49
- it "does not deactivate the gift card" do
49
+ it 'does not deactivate the gift card' do
50
50
  subject
51
51
  expect(gift_card.reload.deactivated_at).to be_nil
52
52
  end
53
53
 
54
- it "redirects to gift card edit page" do
54
+ it 'redirects to gift card edit page' do
55
55
  expect(subject).to redirect_to spree.edit_admin_order_gift_card_path(order, gift_card)
56
56
  end
57
57
 
58
- it "sets the flash message" do
58
+ it 'sets the flash message' do
59
59
  subject
60
- expect(flash[:error]).to eq Spree.t('admin.gift_cards.errors.unable_to_reimburse_gift_card')
60
+ expect(flash[:error]).to eq I18n.t('spree.admin.gift_cards.errors.unable_to_reimburse_gift_card')
61
61
  end
62
62
  end
63
63
 
64
- context "when deactivating fails from reimbursement" do
64
+ context 'when deactivating fails from reimbursement' do
65
65
  before { expect_any_instance_of(Spree::VirtualGiftCard).to receive(:deactivate).and_raise(Spree::Reimbursement::IncompleteReimbursementError) }
66
66
 
67
- it "does not deactivate the gift card" do
67
+ it 'does not deactivate the gift card' do
68
68
  subject
69
69
  expect(gift_card.reload.deactivated_at).to be_nil
70
70
  end
71
71
 
72
- it "redirects to gift card edit page" do
72
+ it 'redirects to gift card edit page' do
73
73
  expect(subject).to redirect_to spree.edit_admin_order_gift_card_path(order, gift_card)
74
74
  end
75
75
 
76
- it "sets the flash message" do
76
+ it 'sets the flash message' do
77
77
  subject
78
- expect(flash[:error]).to eq Spree.t('admin.gift_cards.errors.unable_to_reimburse_gift_card')
78
+ expect(flash[:error]).to eq I18n.t('spree.admin.gift_cards.errors.unable_to_reimburse_gift_card')
79
79
  end
80
80
  end
81
81
  end
@@ -85,48 +85,47 @@ describe Spree::Admin::GiftCardsController do
85
85
  let(:gift_card) { create(:redeemable_virtual_gift_card) }
86
86
  let(:redemption_code) { gift_card.redemption_code }
87
87
 
88
- subject { spree_post :redeem, user_id: user.id, gift_card: { redemption_code: redemption_code } }
88
+ subject { post :redeem, params: { user_id: user.id, gift_card: { redemption_code: redemption_code } } }
89
89
 
90
- context "with a gift card that has not yet been redeemed" do
91
-
92
- it "redirects to store credit index" do
90
+ context 'with a gift card that has not yet been redeemed' do
91
+ it 'redirects to store credit index' do
93
92
  expect(subject).to redirect_to spree.admin_user_store_credits_path(user)
94
93
  end
95
94
 
96
- it "redeems the gift card" do
95
+ it 'redeems the gift card' do
97
96
  subject
98
97
  expect(gift_card.reload.redeemed?).to eq true
99
98
  end
100
99
 
101
- it "sets the redeemer to the correct user" do
100
+ it 'sets the redeemer to the correct user' do
102
101
  subject
103
102
  expect(gift_card.reload.redeemer).to eq user
104
103
  end
105
104
 
106
- it "creates store credit for the user" do
105
+ it 'creates store credit for the user' do
107
106
  subject
108
107
  expect(user.reload.store_credits.count).to eq 1
109
108
  end
110
109
 
111
- it "sets the store credit equal to the amount of the gift card" do
110
+ it 'sets the store credit equal to the amount of the gift card' do
112
111
  subject
113
112
  expect(user.reload.store_credits.first.amount).to eq gift_card.amount
114
113
  end
115
114
  end
116
115
 
117
- context "with a gift card that has already been redeemed" do
116
+ context 'with a gift card that has already been redeemed' do
118
117
  before(:each) { gift_card.update_attribute(:redeemed_at, Date.yesterday) }
119
118
 
120
- it "renders the lookup page" do
119
+ it 'renders the lookup page' do
121
120
  subject
122
121
  expect(response).to render_template(:lookup)
123
122
  end
124
123
  end
125
124
 
126
- context "with a gift card code that does not exist" do
127
- let(:redemption_code) { "INVALID-REDEMPTION-CODE" }
125
+ context 'with a gift card code that does not exist' do
126
+ let(:redemption_code) { 'INVALID-REDEMPTION-CODE' }
128
127
 
129
- it "renders the lookup page" do
128
+ it 'renders the lookup page' do
130
129
  subject
131
130
  expect(response).to render_template(:lookup)
132
131
  end
@@ -2,10 +2,10 @@ require 'spec_helper'
2
2
 
3
3
  describe Spree::Api::GiftCardsController do
4
4
  render_views
5
- let!(:credit_type) { create(:secondary_credit_type, name: "Non-expiring") }
5
+ let!(:credit_type) { create(:secondary_credit_type, name: 'Non-expiring') }
6
6
  let!(:gc_category) { create(:store_credit_gift_card_category) }
7
7
 
8
- describe "POST redeem" do
8
+ describe 'POST redeem' do
9
9
  let(:gift_card) { create(:redeemable_virtual_gift_card) }
10
10
 
11
11
  let(:parameters) do
@@ -14,18 +14,18 @@ describe Spree::Api::GiftCardsController do
14
14
  }
15
15
  end
16
16
 
17
- subject { spree_post :redeem, parameters, { format: :json } }
17
+ subject { post :redeem, params: parameters.merge(format: :json) }
18
18
 
19
- context "the user is not logged in" do
19
+ context 'the user is not logged in' do
20
20
 
21
21
  before { subject }
22
22
 
23
- it "returns a 401" do
23
+ it 'returns a 401' do
24
24
  expect(response.status).to eq 401
25
25
  end
26
26
  end
27
27
 
28
- context "the current api user is authenticated" do
28
+ context 'the current api user is authenticated' do
29
29
  let(:api_user) { create(:user) }
30
30
 
31
31
  before do
@@ -35,7 +35,7 @@ describe Spree::Api::GiftCardsController do
35
35
 
36
36
  let(:parsed_response) { HashWithIndifferentAccess.new(JSON.parse(response.body)) }
37
37
 
38
- context "given an invalid gift card redemption code" do
38
+ context 'given an invalid gift card redemption code' do
39
39
  before { subject }
40
40
 
41
41
  let(:parameters) do
@@ -52,21 +52,20 @@ describe Spree::Api::GiftCardsController do
52
52
  expect(parsed_response['error_message']).to be_present
53
53
  end
54
54
 
55
- it "returns a 404" do
55
+ it 'returns a 404' do
56
56
  expect(subject.status).to eq 404
57
57
  end
58
58
  end
59
59
 
60
- context "there is no redemption code in the request body" do
60
+ context 'there is no redemption code in the request body' do
61
61
  let(:parameters) { {} }
62
62
 
63
- it "returns a 404" do
63
+ it 'returns a 404' do
64
64
  expect(subject.status).to eq 404
65
65
  end
66
66
  end
67
67
 
68
- context "given a valid gift card redemption code" do
69
-
68
+ context 'given a valid gift card redemption code' do
70
69
  it 'finds the gift card' do
71
70
  subject
72
71
  expect(assigns(:gift_card)).to eq gift_card
@@ -78,7 +77,7 @@ describe Spree::Api::GiftCardsController do
78
77
  subject
79
78
  end
80
79
 
81
- it "returns a 201" do
80
+ it 'returns a 201' do
82
81
  subject
83
82
  expect(subject.status).to eq 201
84
83
  end
@@ -1,28 +1,33 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
- describe 'Gift Cards', :type => :feature, :js => true do
3
+ describe "Gift Cards", type: :feature do
4
4
  stub_authorization!
5
5
 
6
+ let(:gift_card) { create(:redeemable_virtual_gift_card) }
7
+ let(:product) { gift_card.line_item.product }
8
+ let!(:order) do
9
+ create(:order_ready_to_ship,
10
+ number: "R100",
11
+ state: "complete",
12
+ line_items: [gift_card.line_item])
13
+ end
6
14
  let(:admin_user) { create(:admin_user) }
7
15
 
8
16
  before do
9
17
  allow_any_instance_of(Spree::Admin::BaseController).to receive(:spree_current_user).and_return(admin_user)
18
+ product.update_attribute(:gift_card, true)
10
19
  end
11
20
 
12
21
  describe "edit gift card" do
13
- let(:gift_card) { create(:redeemable_virtual_gift_card) }
14
- let(:order) { gift_card.line_item.order }
15
22
  let(:new_recipient_name) { "Heidi" }
16
23
  let(:new_recipient_email) { "heidi@gmail.com" }
17
24
  let(:new_purchaser_name) { "Neerali" }
18
25
  let(:new_gift_message) { "Sweaters!" }
19
26
 
20
27
  it "can edit recipient information and send email date" do
21
- visit spree.cart_admin_order_path(order)
28
+ visit spree.edit_admin_order_path(order)
22
29
 
23
- within ".line-item-name" do
24
- click_link("Edit Details")
25
- end
30
+ click_link("Edit Details")
26
31
 
27
32
  fill_in "virtual_gift_card_recipient_name", with: new_recipient_name
28
33
  fill_in "virtual_gift_card_recipient_email", with: new_recipient_email
@@ -30,10 +35,7 @@ describe 'Gift Cards', :type => :feature, :js => true do
30
35
  fill_in "virtual_gift_card_gift_message", with: new_gift_message
31
36
  fill_in "virtual_gift_card_send_email_at", with: Date.tomorrow
32
37
 
33
- # Just so the datepicker gets out of poltergeists way.
34
- page.execute_script("$('#virtual_gift_card_send_email_at').datepicker('widget').hide();")
35
-
36
- click_on 'Update'
38
+ click_on "Update"
37
39
  expect(page).to have_content("Gift card updated!")
38
40
  expect(gift_card.reload.recipient_name).to eq(new_recipient_name)
39
41
  expect(gift_card.recipient_email).to eq(new_recipient_email)
@@ -43,12 +45,12 @@ describe 'Gift Cards', :type => :feature, :js => true do
43
45
  end
44
46
 
45
47
  describe "lookup a gift card" do
46
- let(:gift_card) { create(:redeemable_virtual_gift_card,
47
- recipient_name: "Daeva",
48
- recipient_email: 'dog@example.com',
49
- )
48
+ let(:gift_card) {
49
+ create(:redeemable_virtual_gift_card,
50
+ recipient_name: "Daeva",
51
+ recipient_email: "dog@example.com")
50
52
  }
51
- let(:other_gift_card) { create(:redeemable_virtual_gift_card)}
53
+ let(:other_gift_card) { create(:redeemable_virtual_gift_card) }
52
54
  let(:order) { gift_card.line_item.order }
53
55
 
54
56
  it "can lookup gift card by recipient email" do
@@ -9,17 +9,17 @@ describe 'Gift Cards', type: :feature, js: true do
9
9
  allow_any_instance_of(Spree::Admin::BaseController).to receive(:spree_current_user).and_return(admin_user)
10
10
  end
11
11
 
12
- describe "edit product" do
12
+ describe 'edit product' do
13
13
  let(:product) { create(:product, available_on: 1.year.from_now) }
14
14
 
15
- it "can mark a product as a gift card" do
15
+ it 'can mark a product as a gift card' do
16
16
  visit spree.admin_product_path(product)
17
17
 
18
18
  find('#product_gift_card').click
19
19
 
20
20
  click_on 'Update'
21
21
 
22
- expect(page).to have_content("successfully updated!")
22
+ expect(page).to have_content('successfully updated!')
23
23
  expect(page).to have_field('product_gift_card', checked: true)
24
24
  end
25
25
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "solidus_virtual_gift_card:send_current_emails" do
3
+ describe 'solidus_virtual_gift_card:send_current_emails' do
4
4
 
5
5
  let(:task) { Rake::Task['solidus_virtual_gift_card:send_current_emails'] }
6
6
  let(:purchaser) {create(:user)}
@@ -12,46 +12,46 @@ describe "solidus_virtual_gift_card:send_current_emails" do
12
12
 
13
13
  subject { task.invoke }
14
14
 
15
- context "with gift card sent today" do
16
- it "sends emails to be sent today" do
15
+ context 'with gift card sent today' do
16
+ it 'sends emails to be sent today' do
17
17
  gift_card = Spree::VirtualGiftCard.create!(amount: 50, send_email_at: Date.today, redeemable: true, purchaser: purchaser)
18
18
  expect(Spree::GiftCardMailer).to receive(:gift_card_email).with(gift_card).and_return(double(deliver_later: true))
19
19
  subject
20
20
  end
21
21
 
22
- it "does not send unredeemable giftcards" do
22
+ it 'does not send unredeemable giftcards' do
23
23
  gift_card = Spree::VirtualGiftCard.create!(amount: 50, send_email_at: Date.today)
24
24
  expect(Spree::GiftCardMailer).to_not receive(:gift_card_email).with(gift_card)
25
25
  subject
26
26
  end
27
27
  end
28
28
 
29
- context "with gift card already sent today" do
30
- it "sends emails to be sent today" do
29
+ context 'with gift card already sent today' do
30
+ it 'sends emails to be sent today' do
31
31
  Spree::VirtualGiftCard.create!(amount: 50, send_email_at: Date.today, sent_at: DateTime.now, redeemable: true, purchaser: purchaser)
32
32
  expect(Spree::GiftCardMailer).to_not receive(:gift_card_email)
33
33
  subject
34
34
  end
35
35
  end
36
36
 
37
- context "with gift cards sent in the future" do
38
- it "does not sends emails" do
37
+ context 'with gift cards sent in the future' do
38
+ it 'does not sends emails' do
39
39
  Spree::VirtualGiftCard.create!(amount: 50, send_email_at: 10.days.from_now.to_date, redeemable: true, purchaser: purchaser)
40
40
  expect(Spree::GiftCardMailer).to_not receive(:gift_card_email)
41
41
  subject
42
42
  end
43
43
  end
44
44
 
45
- context "with gift cards sent in the past" do
46
- it "does not sends emails" do
45
+ context 'with gift cards sent in the past' do
46
+ it 'does not sends emails' do
47
47
  Spree::VirtualGiftCard.create!(amount: 50, send_email_at: 1.days.ago, sent_at: 1.days.ago.to_date, redeemable: true, purchaser: purchaser)
48
48
  expect(Spree::GiftCardMailer).to_not receive(:gift_card_email)
49
49
  subject
50
50
  end
51
51
  end
52
52
 
53
- context "with gift cards not specified" do
54
- it "does not sends emails" do
53
+ context 'with gift cards not specified' do
54
+ it 'does not sends emails' do
55
55
  Spree::VirtualGiftCard.create!(amount: 50, send_email_at: nil)
56
56
  expect(Spree::GiftCardMailer).to_not receive(:gift_card_email)
57
57
  subject
@@ -6,13 +6,13 @@ describe Spree::GiftCardMailer, type: :mailer do
6
6
 
7
7
  subject { Spree::GiftCardMailer.gift_card_email(gift_card) }
8
8
 
9
- context "the recipient email is blank" do
9
+ context 'the recipient email is blank' do
10
10
  before do
11
- gift_card.update_attributes!(recipient_email: "")
12
- gift_card.line_item.order.update_attributes!(email: "gift_card_tester@example.com")
11
+ gift_card.update!(recipient_email: '')
12
+ gift_card.line_item.order.update!(email: 'gift_card_tester@example.com')
13
13
  end
14
14
 
15
- it "uses the email associated with the order" do
15
+ it 'uses the email associated with the order' do
16
16
  expect(subject.to).to contain_exactly('gift_card_tester@example.com')
17
17
  end
18
18
  end
@@ -14,7 +14,7 @@ describe Spree::RedemptionCodeGenerator do
14
14
  subject { Spree::RedemptionCodeGenerator.format_redemption_code_for_lookup(redemption_code) }
15
15
 
16
16
  context 'redemption code has no dashes' do
17
- let(:redemption_code) { "1234ABCD1234ABCD" }
17
+ let(:redemption_code) { '1234ABCD1234ABCD' }
18
18
 
19
19
  it 'does nothing to the code' do
20
20
  expect(subject).to eq redemption_code
@@ -22,8 +22,8 @@ describe Spree::RedemptionCodeGenerator do
22
22
  end
23
23
 
24
24
  context 'redemption code 4 groups of 4 characters, separated by dashes' do
25
- let(:redemption_code) { "1234-ABCD-1234-ABCD" }
26
- let(:formatted_redemption_code) { "1234ABCD1234ABCD" }
25
+ let(:redemption_code) { '1234-ABCD-1234-ABCD' }
26
+ let(:formatted_redemption_code) { '1234ABCD1234ABCD' }
27
27
 
28
28
  it 'strips the dashes' do
29
29
  expect(subject).to eq formatted_redemption_code
@@ -31,8 +31,8 @@ describe Spree::RedemptionCodeGenerator do
31
31
  end
32
32
 
33
33
  context 'redemption code is mixed-case' do
34
- let(:redemption_code) { "1234-aBCd-1234-AbcD" }
35
- let(:formatted_redemption_code) { "1234ABCD1234ABCD" }
34
+ let(:redemption_code) { '1234-aBCd-1234-AbcD' }
35
+ let(:formatted_redemption_code) { '1234ABCD1234ABCD' }
36
36
 
37
37
  it 'makes it all upcase' do
38
38
  expect(subject).to eq formatted_redemption_code
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Spree::LineItem do
4
- describe "#redemption_codes" do
4
+ describe '#redemption_codes' do
5
5
  let(:line_item) { create(:line_item, quantity: 2) }
6
6
  let!(:gift_card) { create(:virtual_gift_card, line_item: line_item) }
7
7
  let!(:gift_card_2) { create(:virtual_gift_card, line_item: line_item) }
@@ -28,7 +28,7 @@ describe Spree::LineItem do
28
28
  end
29
29
  end
30
30
 
31
- describe "#gift_card_details" do
31
+ describe '#gift_card_details' do
32
32
  let(:line_item) { create(:line_item, quantity: 2) }
33
33
  let!(:gift_card) { create(:redeemable_virtual_gift_card, line_item: line_item) }
34
34
  let!(:gift_card_2) { create(:redeemable_virtual_gift_card, line_item: line_item) }