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
@@ -1,6 +1,6 @@
1
1
  Deface::Override.new(
2
- virtual_path: "spree/admin/orders/confirm",
3
- name: "add_gift_cards_to_admin_order_confirmation",
4
- insert_before: "#order-total",
5
- partial: "spree/admin/orders/confirmation_gift_card_details",
2
+ virtual_path: 'spree/admin/orders/confirm',
3
+ name: 'add_gift_cards_to_admin_order_confirmation',
4
+ insert_before: '#order-total',
5
+ partial: 'spree/admin/orders/confirmation_gift_card_details'
6
6
  )
@@ -1,20 +1,20 @@
1
1
  Deface::Override.new(
2
- virtual_path: "spree/admin/orders/_line_items",
3
- name: "add_gift_cards_to_admin_line_items",
4
- insert_bottom: ".line-item-name",
5
- partial: "spree/admin/orders/cart_gift_card_details",
2
+ virtual_path: 'spree/admin/orders/confirm/_shipment_manifest',
3
+ name: 'add_gift_cards_to_admin_confirm',
4
+ insert_bottom: '.item-name',
5
+ partial: 'spree/admin/orders/cart_gift_card_details',
6
6
  )
7
7
 
8
8
  Deface::Override.new(
9
- virtual_path: "spree/admin/orders/_shipment_manifest",
10
- name: "admin_item_view_gift_card_codes",
11
- insert_bottom: ".item-name",
12
- partial: "spree/admin/orders/shipments_gift_card_details",
9
+ virtual_path: 'spree/admin/orders/_shipment_manifest',
10
+ name: 'admin_item_view_gift_card_codes',
11
+ insert_bottom: '.item-name',
12
+ partial: 'spree/admin/orders/shipments_gift_card_details',
13
13
  )
14
14
 
15
15
  Deface::Override.new(
16
- virtual_path: "spree/admin/orders/_carton_manifest",
17
- name: "admin_item_view_gift_card_codes",
18
- insert_bottom: ".item-name",
19
- partial: "spree/admin/orders/shipments_gift_card_details",
16
+ virtual_path: 'spree/admin/orders/_carton_manifest',
17
+ name: 'admin_item_view_gift_card_codes',
18
+ insert_bottom: '.item-name',
19
+ partial: 'spree/admin/orders/shipments_gift_card_details',
20
20
  )
@@ -1,6 +1,6 @@
1
1
  Deface::Override.new(
2
- virtual_path: "spree/admin/users/_sidebar",
3
- name: "admin_user_sidebar_store_credits",
2
+ virtual_path: 'spree/admin/users/_sidebar',
3
+ name: 'admin_user_sidebar_store_credits',
4
4
  insert_bottom: "[data-hook='admin_user_tab_options']",
5
- partial: "spree/admin/users/gift_card_sidebar",
5
+ partial: 'spree/admin/users/gift_card_sidebar'
6
6
  )
@@ -1,6 +1,6 @@
1
1
  Deface::Override.new(
2
- virtual_path: "spree/admin/shared/_tabs",
3
- name: "admin_user_sub_menu_index",
2
+ virtual_path: 'spree/admin/shared/_tabs',
3
+ name: 'admin_user_sub_menu_index',
4
4
  replace: "erb[loud]:contains('BackendConfiguration::USER_TABS')",
5
5
  text: <<-ERB)
6
6
  <%= tab *Spree::BackendConfiguration::USER_TABS, url: spree.admin_users_path, icon: 'user' do %>
@@ -1,5 +1,5 @@
1
1
  <% content_for :table_filter_title do %>
2
- <%= Spree.t(:search) %>
2
+ <%= I18n.t('spree.search') %>
3
3
  <% end %>
4
4
 
5
5
  <% content_for :table_filter do %>
@@ -33,7 +33,7 @@
33
33
  <div class="clearfix"></div>
34
34
 
35
35
  <div class="actions filter-actions">
36
- <%= button 'Lookup Gift Card', 'search' %>
36
+ <%= button_tag 'Lookup Gift Card' %>
37
37
  </div>
38
38
  <% end %>
39
39
  </div>
@@ -1,7 +1,7 @@
1
1
  <div class="row">
2
2
  <div class="alpha twelve columns">
3
3
  <%= f.field_container :redemption_code do %>
4
- <%= f.label :redemption_code, Spree.t('admin.gift_cards.redemption_code') %> <span class="required">*</span><br />
4
+ <%= f.label :redemption_code, I18n.t('spree.admin.gift_cards.redemption_code') %> <span class="required">*</span><br />
5
5
  <%= f.text_field :redemption_code %>
6
6
  <% end %>
7
7
  </div>
@@ -22,7 +22,7 @@
22
22
  <div class="row">
23
23
  <div class="alpha twelve columns">
24
24
  <%= f.field_container :recipient_name do %>
25
- <%= f.label :recipient_name, Spree.t('admin.gift_cards.recipient_name') %> <br />
25
+ <%= f.label :recipient_name, I18n.t('spree.admin.gift_cards.recipient_name') %> <br />
26
26
  <%= f.text_field :recipient_name, class: 'fullwidth' %>
27
27
  <% end %>
28
28
  </div>
@@ -31,7 +31,7 @@
31
31
  <div class="row">
32
32
  <div class="alpha twelve columns">
33
33
  <%= f.field_container :recipient_email do %>
34
- <%= f.label :recipient_email, Spree.t('admin.gift_cards.recipient_email') %> <br />
34
+ <%= f.label :recipient_email, I18n.t('spree.admin.gift_cards.recipient_email') %> <br />
35
35
  <%= f.text_field :recipient_email, class: 'fullwidth' %>
36
36
  <% end %>
37
37
  </div>
@@ -40,7 +40,7 @@
40
40
  <div class="row">
41
41
  <div class="alpha twelve columns">
42
42
  <%= f.field_container :purchaser_name do %>
43
- <%= f.label :purchaser_name, Spree.t('admin.gift_cards.purchaser_name') %> <br />
43
+ <%= f.label :purchaser_name, I18n.t('spree.admin.gift_cards.purchaser_name') %> <br />
44
44
  <%= f.text_field :purchaser_name, class: 'fullwidth' %>
45
45
  <% end %>
46
46
  </div>
@@ -49,7 +49,7 @@
49
49
  <div class="row">
50
50
  <div class="alpha twelve columns">
51
51
  <%= f.field_container :gift_message do %>
52
- <%= f.label :gift_message, Spree.t('admin.gift_cards.gift_message') %> <br />
52
+ <%= f.label :gift_message, I18n.t('spree.admin.gift_cards.gift_message') %> <br />
53
53
  <%= f.text_area :gift_message, class: 'fullwidth', maxlength: '140' %>
54
54
  <% end %>
55
55
  </div>
@@ -63,7 +63,7 @@
63
63
  </div>
64
64
  <% else %>
65
65
  <%= f.field_container :send_email_at do %>
66
- <%= f.label :send_email_at, Spree.t('admin.gift_cards.send_email_at') %> <br />
66
+ <%= f.label :send_email_at, I18n.t('spree.admin.gift_cards.send_email_at') %> <br />
67
67
  <%= f.text_field :send_email_at, :class => 'datepicker datepicker-from giftcard-datepicker' %>
68
68
  <% end %>
69
69
  <% end %>
@@ -1,5 +1,5 @@
1
1
  <% content_for :page_title do %>
2
- <%= Spree.t(:listing_gift_cards) %>
2
+ <%= I18n.t('spree.listing_gift_cards') %>
3
3
  <% end %>
4
4
 
5
5
  <%= render partial: 'lookup_form' %>
@@ -1,5 +1,5 @@
1
1
  <% content_for :page_title do %>
2
- <%= link_to "#{Spree.t(:editing_user)} #{@user.email}", edit_admin_user_url(@user) %>
2
+ <%= link_to "#{I18n.t('spree.editing_user')} #{@user.email}", edit_admin_user_url(@user) %>
3
3
  <% end %>
4
4
 
5
5
  <%= render :partial => 'spree/admin/users/sidebar', :locals => { :current => :gift_cards } %>
@@ -1,6 +1,6 @@
1
1
  <fieldset class="no-border-bottom">
2
2
  <legend align="center" data-hook="gift-card">
3
- <%= Spree.t(:gift_cards_details) %>
3
+ <%= I18n.t('spree.gift_cards_details') %>
4
4
  </legend>
5
5
  </fieldset>
6
6
 
@@ -15,13 +15,13 @@
15
15
  </colgroup>
16
16
 
17
17
  <thead>
18
- <th><%= Spree.t(:recipient_email) %></th>
19
- <th><%= Spree.t(:recipient_name) %></th>
20
- <th><%= Spree.t(:purchaser_name) %></th>
21
- <th><%= Spree.t(:gift_message) %></th>
22
- <th><%= Spree.t(:send_email_at) %></th>
18
+ <th><%= I18n.t('spree.recipient_email') %></th>
19
+ <th><%= I18n.t('spree.recipient_name') %></th>
20
+ <th><%= I18n.t('spree.purchaser_name') %></th>
21
+ <th><%= I18n.t('spree.gift_message') %></th>
22
+ <th><%= I18n.t('spree.send_email_at') %></th>
23
23
  </thead>
24
-
24
+
25
25
 
26
26
  <tbody>
27
27
  <% @order.line_items.flat_map(&:gift_cards).each do |gift_card| %>
@@ -42,9 +42,9 @@
42
42
  <%= gift_card.formatted_send_email_at || "Immediately" %>
43
43
  </td>
44
44
  <td class="actions">
45
- <%= link_to '', edit_admin_order_gift_card_path(@order, gift_card), :class => 'fa fa-edit no-text with-tip', :title => Spree.t('actions.edit') %>
45
+ <%= link_to '', edit_admin_order_gift_card_path(@order, gift_card), :class => 'fa fa-edit no-text with-tip', :title => I18n.t('spree.actions.edit') %>
46
46
  </td>
47
47
  </tr>
48
48
  <% end %>
49
49
  </tbody>
50
- </table>
50
+ </table>
@@ -1,7 +1,7 @@
1
- <br><strong><%= Spree.t('admin.gift_cards.redemption_code') %>:</strong> <%= gift_card.redemption_code %>
1
+ <br><strong><%= I18n.t('spree.admin.gift_cards.redemption_code') %>:</strong> <%= gift_card.redemption_code %>
2
2
  <br>
3
3
  <% if gift_card.deactivated? %>
4
4
  <b>DEACTIVATED</b>
5
5
  <% end %>
6
6
  <% edit_text = gift_card.deactivated? ? "(Details)" : "(Edit Details)" %>
7
- <%= link_to edit_text, edit_admin_order_gift_card_path(@order, gift_card), class: 'edit-gift-card-details' %>
7
+ <%= link_to edit_text, spree.edit_admin_order_gift_card_path(@order, gift_card), class: 'edit-gift-card-details' %>
@@ -1,3 +1,3 @@
1
1
  <li<%== ' class="active"' if current == :gift_cards %>>
2
- <%= link_to_with_icon 'gift', Spree.t(:"admin.gift_cards.redeem_gift_card"), lookup_admin_user_gift_cards_path(@user) %>
3
- </li>
2
+ <%= link_to_with_icon 'gift', Spree.t(:"admin.gift_cards.redeem_gift_card"), spree.lookup_admin_user_gift_cards_path(@user) %>
3
+ </li>
@@ -1,7 +1,7 @@
1
- <%= Spree.t('gift_card_mailer.gift_card_email.dear_customer') %>
1
+ <%= I18n.t('spree.gift_card_mailer.gift_card_email.dear_customer') %>
2
2
 
3
- <%= Spree.t('gift_card_mailer.gift_card_email.your_gift_card_code') %>
3
+ <%= I18n.t('spree.gift_card_mailer.gift_card_email.your_gift_card_code') %>
4
4
 
5
5
  ============================================================
6
- <%= Spree.t('gift_card_mailer.gift_card_email.gift_card_code', code: @gift_card.redemption_code) %>
6
+ <%= I18n.t('spree.gift_card_mailer.gift_card_email.gift_card_code', code: @gift_card.redemption_code) %>
7
7
  ============================================================
@@ -1,4 +1,4 @@
1
1
  Rails.application.config.to_prepare do
2
- Spree::Api::LineItemsController.line_item_options += [gift_card_details: [:recipient_name, :recipient_email, :gift_message, :purchaser_name, :send_email_at]]
2
+ Spree::PermittedAttributes.line_item_attributes << { options: [gift_card_details: [:recipient_name, :recipient_email, :gift_message, :purchaser_name, :send_email_at]] }
3
3
  Spree::Order.line_item_comparison_hooks.add('gift_card_match')
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreateVirtualGiftCard < ActiveRecord::Migration
1
+ class CreateVirtualGiftCard < SolidusSupport::Migration[4.2]
2
2
  def change
3
3
  create_table :spree_virtual_gift_cards do |t|
4
4
  t.integer :purchaser_id
@@ -1,4 +1,4 @@
1
- class SeedGiftCardCategory < ActiveRecord::Migration
1
+ class SeedGiftCardCategory < SolidusSupport::Migration[4.2]
2
2
  def change
3
3
  Spree::StoreCreditCategory.find_or_create_by(name: 'Gift Card')
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddTimestampsToGiftCards < ActiveRecord::Migration
1
+ class AddTimestampsToGiftCards < SolidusSupport::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_virtual_gift_cards, :created_at, :datetime
4
4
  add_column :spree_virtual_gift_cards, :updated_at, :datetime
@@ -1,4 +1,4 @@
1
- class AddGiftCardFlagToProducts < ActiveRecord::Migration
1
+ class AddGiftCardFlagToProducts < SolidusSupport::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_products, :gift_card, :boolean, default: false
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddLineItemToGiftCard < ActiveRecord::Migration
1
+ class AddLineItemToGiftCard < SolidusSupport::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_virtual_gift_cards, :line_item_id, :integer
4
4
 
@@ -1,4 +1,4 @@
1
- class AddRecipientFieldsToVirtualGiftCard < ActiveRecord::Migration
1
+ class AddRecipientFieldsToVirtualGiftCard < SolidusSupport::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_virtual_gift_cards, :recipient_name, :string
4
4
  add_column :spree_virtual_gift_cards, :recipient_email, :string
@@ -1,4 +1,4 @@
1
- class AddActiveFlagToVirtualGiftCard < ActiveRecord::Migration
1
+ class AddActiveFlagToVirtualGiftCard < SolidusSupport::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_virtual_gift_cards, :redeemable, :boolean, default: false
4
4
  end
@@ -1,7 +1,7 @@
1
- class SetRedeemableTrueOnVirtualGiftCards < ActiveRecord::Migration
1
+ class SetRedeemableTrueOnVirtualGiftCards < SolidusSupport::Migration[4.2]
2
2
  def up
3
3
  Spree::VirtualGiftCard.find_each do |gift_card|
4
- gift_card.update_attributes!(redeemable: true)
4
+ gift_card.update!(redeemable: true)
5
5
  end
6
6
  end
7
7
 
@@ -1,4 +1,4 @@
1
- class AddEmailSendTimeToVirtualGiftCard < ActiveRecord::Migration
1
+ class AddEmailSendTimeToVirtualGiftCard < SolidusSupport::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_virtual_gift_cards, :send_email_at, :date
4
4
  add_column :spree_virtual_gift_cards, :sent_at, :datetime
@@ -1,4 +1,4 @@
1
- class AddDeactivatedAtToGiftCard < ActiveRecord::Migration
1
+ class AddDeactivatedAtToGiftCard < SolidusSupport::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_virtual_gift_cards, :deactivated_at, :datetime
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddInventoryUnitToGiftCard < ActiveRecord::Migration
1
+ class AddInventoryUnitToGiftCard < SolidusSupport::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_virtual_gift_cards, :inventory_unit_id, :integer
4
4
  end
@@ -1,4 +1,4 @@
1
- class BackfillInventoryUnitsOnGiftCard < ActiveRecord::Migration
1
+ class BackfillInventoryUnitsOnGiftCard < SolidusSupport::Migration[4.2]
2
2
  def up
3
3
  gift_card_products = Spree::Product.where(gift_card: true)
4
4
 
@@ -11,7 +11,7 @@ class BackfillInventoryUnitsOnGiftCard < ActiveRecord::Migration
11
11
 
12
12
  line_item.gift_cards.each_with_index do |gift_card, i|
13
13
  inventory_unit = inventory_units[i]
14
- gift_card.update_attributes!(inventory_unit: inventory_unit)
14
+ gift_card.update!(inventory_unit: inventory_unit)
15
15
  say "Updating gift card #{gift_card.id} to have inventory unit #{inventory_unit.id}"
16
16
  end
17
17
  else
@@ -9,7 +9,7 @@ module SolidusVirtualGiftCard
9
9
  end
10
10
 
11
11
  def include_seed_data
12
- append_file "db/seeds.rb", <<-SEEDS
12
+ append_file 'db/seeds.rb', <<-SEEDS
13
13
  \n
14
14
  SpreeVirtualGiftCard::Engine.load_seed if defined?(SpreeVirtualGiftCard::Engine)
15
15
  SEEDS
@@ -1,2 +1,3 @@
1
1
  require 'spree_core'
2
+ require 'deface'
2
3
  require 'spree_virtual_gift_card/engine'
@@ -1,16 +1,16 @@
1
1
  module SpreeVirtualGiftCard
2
2
  class Engine < Rails::Engine
3
- require "solidus_core"
3
+ require 'solidus_core'
4
4
 
5
5
  isolate_namespace Spree
6
- engine_name "solidus_virtual_gift_card"
6
+ engine_name 'solidus_virtual_gift_card'
7
7
 
8
8
  config.generators do |g|
9
9
  g.test_framework :rspec
10
10
  end
11
11
 
12
12
  def self.activate
13
- Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
13
+ Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
14
14
  Rails.configuration.cache_classes ? require(c) : load(c)
15
15
  end
16
16
  end
@@ -1,14 +1,14 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :store_credit_gift_card_category, class: Spree::StoreCreditCategory do
3
- name Spree::StoreCreditCategory::GIFT_CARD_CATEGORY_NAME
3
+ name { Spree::StoreCreditCategory::GIFT_CARD_CATEGORY_NAME }
4
4
  end
5
5
 
6
6
  factory :virtual_gift_card, class: Spree::VirtualGiftCard do
7
7
  association :line_item, factory: :line_item
8
- amount 25.0
9
- currency "USD"
10
- recipient_name "Tom Riddle"
11
- recipient_email "me@lordvoldemort.com"
8
+ amount { 25.0 }
9
+ currency { 'USD' }
10
+ recipient_name { 'Tom Riddle' }
11
+ recipient_email { 'me@lordvoldemort.com' }
12
12
 
13
13
  factory :redeemable_virtual_gift_card do
14
14
  association :purchaser, factory: :user
@@ -17,7 +17,7 @@ FactoryGirl.define do
17
17
  create(:inventory_unit, line_item: gift_card.line_item)
18
18
  end
19
19
 
20
- redeemable true
20
+ redeemable { true }
21
21
 
22
22
  before(:create) do |gift_card, evaluator|
23
23
  gift_card.redemption_code = gift_card.send(:generate_unique_redemption_code)
@@ -1,5 +1,5 @@
1
1
  namespace :solidus_virtual_gift_card do
2
- desc "Send todays gift card emails"
2
+ desc 'Send todays gift card emails'
3
3
  task :send_current_emails => :environment do
4
4
  Spree::VirtualGiftCard.where(send_email_at: Date.today, sent_at: nil, redeemable: true).find_each do |gift_card|
5
5
  gift_card.send_email
@@ -2,32 +2,34 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.platform = Gem::Platform::RUBY
5
- s.name = "solidus_virtual_gift_card"
6
- s.version = "1.2.0"
5
+ s.name = 'solidus_virtual_gift_card'
6
+ s.version = '1.3.0'
7
7
  s.summary = "Virtual gift card for purchase, drops into the user's account as store credit"
8
- s.required_ruby_version = ">= 2.1"
8
+ s.required_ruby_version = ">= 2.2.2"
9
9
 
10
- s.author = "Solidus Team"
11
- s.email = "contact@solidus.io"
12
- s.homepage = "https://solidus.io"
13
- s.license = "BSD-3-Clause"
10
+ s.author = 'Solidus Team'
11
+ s.email = 'contact@solidus.io'
12
+ s.homepage = 'https://solidus.io'
13
+ s.license = 'BSD-3-Clause'
14
14
 
15
15
  s.files = `git ls-files`.split("\n")
16
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- s.require_path = "lib"
18
- s.requirements << "none"
17
+ s.require_path = 'lib'
18
+ s.requirements << 'none'
19
19
 
20
- s.add_dependency "solidus", "~> 1.2.0"
21
- s.add_dependency "deface"
20
+ s.add_dependency "solidus", [">= 1.2", "< 3"]
21
+ s.add_dependency 'deface'
22
22
 
23
- s.add_development_dependency "rspec-rails", "~> 3.2"
24
- s.add_development_dependency "simplecov"
25
- s.add_development_dependency "sqlite3"
26
- s.add_development_dependency "sass-rails"
27
- s.add_development_dependency "coffee-rails"
28
- s.add_development_dependency "factory_girl"
29
- s.add_development_dependency "capybara"
30
- s.add_development_dependency "poltergeist"
31
- s.add_development_dependency "database_cleaner"
32
- s.add_development_dependency "ffaker"
23
+ s.add_development_dependency 'rspec-rails', '~> 4.0.0.beta2'
24
+ s.add_development_dependency 'simplecov'
25
+ s.add_development_dependency 'sqlite3'
26
+ s.add_development_dependency 'sass-rails'
27
+ s.add_development_dependency 'coffee-rails'
28
+ s.add_development_dependency 'factory_bot'
29
+ s.add_development_dependency 'capybara', '~> 2.18'
30
+ s.add_development_dependency 'poltergeist'
31
+ s.add_development_dependency 'solidus_support'
32
+ s.add_development_dependency 'database_cleaner'
33
+ s.add_development_dependency 'webdrivers'
34
+ s.add_development_dependency 'ffaker'
33
35
  end