summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--solidus_subscriptions.gemspec2
-rw-r--r--spec/controllers/orders/create_subscription_line_items_spec.rb2
-rw-r--r--spec/controllers/solidus_subscriptions/api/v1/line_items_controller_spec.rb2
-rw-r--r--spec/controllers/solidus_subscriptions/api/v1/subscriptions_controller_spec.rb2
-rw-r--r--spec/controllers/spree/admin/subscriptions_controller_spec.rb2
-rw-r--r--spec/controllers/spree/api/line_items_controller_spec.rb2
-rw-r--r--spec/controllers/spree/api/orders_controller_spec.rb2
-rw-r--r--spec/controllers/spree/api/users_controller_spec.rb2
-rw-r--r--spec/features/admin_link_spec.rb2
-rw-r--r--spec/jobs/solidus_subscriptions/process_installments_job_spec.rb2
-rw-r--r--spec/lib/solidus_subscriptions/ability_spec.rb2
-rw-r--r--spec/lib/solidus_subscriptions/config_spec.rb2
-rw-r--r--spec/lib/solidus_subscriptions/processor_spec.rb2
-rw-r--r--spec/models/solidus_subscriptions/checkout_spec.rb2
-rw-r--r--spec/models/solidus_subscriptions/dispatcher_spec.rb2
-rw-r--r--spec/models/solidus_subscriptions/failure_dispatcher_spec.rb2
-rw-r--r--spec/models/solidus_subscriptions/installment_detail_spec.rb2
-rw-r--r--spec/models/solidus_subscriptions/installment_spec.rb2
-rw-r--r--spec/models/solidus_subscriptions/line_item_builder_spec.rb2
-rw-r--r--spec/models/solidus_subscriptions/line_item_spec.rb2
-rw-r--r--spec/models/solidus_subscriptions/order_builder_spec.rb2
-rw-r--r--spec/models/solidus_subscriptions/out_of_stock_dispatcher_spec.rb2
-rw-r--r--spec/models/solidus_subscriptions/payment_failed_dispatcher_spec.rb2
-rw-r--r--spec/models/solidus_subscriptions/subscription_generator_spec.rb2
-rw-r--r--spec/models/solidus_subscriptions/subscription_order_promotion_rule_spec.rb2
-rw-r--r--spec/models/solidus_subscriptions/subscription_promotion_rule_spec.rb2
-rw-r--r--spec/models/solidus_subscriptions/subscription_spec.rb2
-rw-r--r--spec/models/solidus_subscriptions/success_dispatcher_spec.rb2
-rw-r--r--spec/models/spree/variant_spec.rb2
-rw-r--r--spec/overrides/spree/line_items/subscription_line_items_association_spec.rb2
-rw-r--r--spec/overrides/spree/orders/finalize_creates_subscrptions_spec.rb2
-rw-r--r--spec/overrides/spree/orders/subscription_line_items_association_spec.rb2
-rw-r--r--spec/overrides/spree/users/have_many_subscriptions.rb2
-rw-r--r--spec/rails_helper.rb52
-rw-r--r--spec/requests/solidus_subscriptions/api/v1/subscriptions_spec.rb2
-rw-r--r--spec/spec_helper.rb66
-rw-r--r--spec/support/active_model_mocks.rb1
-rw-r--r--spec/support/factories.rb3
-rw-r--r--spec/support/helpers/checkout_infrastructure.rb (renamed from spec/helpers/checkout_infrastructure.rb)4
-rw-r--r--spec/support/shoulda.rb7
-rw-r--r--spec/support/timecop.rb1
-rw-r--r--spec/support/version_cake.rb8
43 files changed, 64 insertions, 147 deletions
diff --git a/.gitignore b/.gitignore
index 62abeb7..5d55589 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,4 @@ pkg
*.swp
spec/dummy
.bundle
+spec/examples.txt
diff --git a/solidus_subscriptions.gemspec b/solidus_subscriptions.gemspec
index e7afbdd..b063fb2 100644
--- a/solidus_subscriptions.gemspec
+++ b/solidus_subscriptions.gemspec
@@ -22,8 +22,6 @@ Gem::Specification.new do |s|
s.add_dependency 'solidus_support'
s.add_dependency 'state_machines'
- s.add_development_dependency 'coffee-rails'
- s.add_development_dependency 'pry'
s.add_development_dependency 'rspec-activemodel-mocks'
s.add_development_dependency 'shoulda-matchers', '~> 3.1'
s.add_development_dependency 'solidus_extension_dev_tools'
diff --git a/spec/controllers/orders/create_subscription_line_items_spec.rb b/spec/controllers/orders/create_subscription_line_items_spec.rb
index 337e025..eac1b69 100644
--- a/spec/controllers/orders/create_subscription_line_items_spec.rb
+++ b/spec/controllers/orders/create_subscription_line_items_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe Spree::Controllers::Orders::CreateSubscriptionLineItems, type: :controller do
controller(Spree::OrdersController) {}
diff --git a/spec/controllers/solidus_subscriptions/api/v1/line_items_controller_spec.rb b/spec/controllers/solidus_subscriptions/api/v1/line_items_controller_spec.rb
index 71107a8..b570bca 100644
--- a/spec/controllers/solidus_subscriptions/api/v1/line_items_controller_spec.rb
+++ b/spec/controllers/solidus_subscriptions/api/v1/line_items_controller_spec.rb
@@ -1,4 +1,4 @@
-require "rails_helper"
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::Api::V1::LineItemsController, type: :controller do
routes { SolidusSubscriptions::Engine.routes }
diff --git a/spec/controllers/solidus_subscriptions/api/v1/subscriptions_controller_spec.rb b/spec/controllers/solidus_subscriptions/api/v1/subscriptions_controller_spec.rb
index 05f82bc..182993f 100644
--- a/spec/controllers/solidus_subscriptions/api/v1/subscriptions_controller_spec.rb
+++ b/spec/controllers/solidus_subscriptions/api/v1/subscriptions_controller_spec.rb
@@ -1,4 +1,4 @@
-require "rails_helper"
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::Api::V1::SubscriptionsController, type: :controller do
routes { SolidusSubscriptions::Engine.routes }
diff --git a/spec/controllers/spree/admin/subscriptions_controller_spec.rb b/spec/controllers/spree/admin/subscriptions_controller_spec.rb
index 310430f..36df187 100644
--- a/spec/controllers/spree/admin/subscriptions_controller_spec.rb
+++ b/spec/controllers/spree/admin/subscriptions_controller_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe Spree::Admin::SubscriptionsController, type: :request do
extend Spree::TestingSupport::AuthorizationHelpers::Request
diff --git a/spec/controllers/spree/api/line_items_controller_spec.rb b/spec/controllers/spree/api/line_items_controller_spec.rb
index 9a56129..4571d89 100644
--- a/spec/controllers/spree/api/line_items_controller_spec.rb
+++ b/spec/controllers/spree/api/line_items_controller_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
require 'spree/api/testing_support/helpers'
RSpec.describe Spree::Api::LineItemsController, type: :controller do
diff --git a/spec/controllers/spree/api/orders_controller_spec.rb b/spec/controllers/spree/api/orders_controller_spec.rb
index fe15ede..1693b5d 100644
--- a/spec/controllers/spree/api/orders_controller_spec.rb
+++ b/spec/controllers/spree/api/orders_controller_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
require 'spree/api/testing_support/helpers'
RSpec.describe Spree::Api::OrdersController, type: :controller do
diff --git a/spec/controllers/spree/api/users_controller_spec.rb b/spec/controllers/spree/api/users_controller_spec.rb
index 470c837..3acbcc7 100644
--- a/spec/controllers/spree/api/users_controller_spec.rb
+++ b/spec/controllers/spree/api/users_controller_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
require 'spree/api/testing_support/helpers'
RSpec.describe Spree::Api::UsersController, type: :controller do
diff --git a/spec/features/admin_link_spec.rb b/spec/features/admin_link_spec.rb
index e0fedc0..8ec1176 100644
--- a/spec/features/admin_link_spec.rb
+++ b/spec/features/admin_link_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.feature 'Subscriptions admin link', type: :feature do
stub_authorization!
diff --git a/spec/jobs/solidus_subscriptions/process_installments_job_spec.rb b/spec/jobs/solidus_subscriptions/process_installments_job_spec.rb
index 469089a..111fc05 100644
--- a/spec/jobs/solidus_subscriptions/process_installments_job_spec.rb
+++ b/spec/jobs/solidus_subscriptions/process_installments_job_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::ProcessInstallmentsJob do
let(:root_order) { create :completed_order_with_pending_payment }
diff --git a/spec/lib/solidus_subscriptions/ability_spec.rb b/spec/lib/solidus_subscriptions/ability_spec.rb
index 6151df2..5e2903d 100644
--- a/spec/lib/solidus_subscriptions/ability_spec.rb
+++ b/spec/lib/solidus_subscriptions/ability_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
require "cancan/matchers"
RSpec.describe SolidusSubscriptions::Ability do
diff --git a/spec/lib/solidus_subscriptions/config_spec.rb b/spec/lib/solidus_subscriptions/config_spec.rb
index dcb6cf7..b5b8519 100644
--- a/spec/lib/solidus_subscriptions/config_spec.rb
+++ b/spec/lib/solidus_subscriptions/config_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::Config do
before { described_class.instance_variable_set('@gateway', nil) }
diff --git a/spec/lib/solidus_subscriptions/processor_spec.rb b/spec/lib/solidus_subscriptions/processor_spec.rb
index 08aa9e3..863c84e 100644
--- a/spec/lib/solidus_subscriptions/processor_spec.rb
+++ b/spec/lib/solidus_subscriptions/processor_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::Processor, :checkout do
include ActiveJob::TestHelper
diff --git a/spec/models/solidus_subscriptions/checkout_spec.rb b/spec/models/solidus_subscriptions/checkout_spec.rb
index c3a7aa1..e3a6ac0 100644
--- a/spec/models/solidus_subscriptions/checkout_spec.rb
+++ b/spec/models/solidus_subscriptions/checkout_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::Checkout do
let(:checkout) { described_class.new(installments) }
diff --git a/spec/models/solidus_subscriptions/dispatcher_spec.rb b/spec/models/solidus_subscriptions/dispatcher_spec.rb
index b2fd372..d902057 100644
--- a/spec/models/solidus_subscriptions/dispatcher_spec.rb
+++ b/spec/models/solidus_subscriptions/dispatcher_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::Dispatcher do
describe '#dispatch' do
diff --git a/spec/models/solidus_subscriptions/failure_dispatcher_spec.rb b/spec/models/solidus_subscriptions/failure_dispatcher_spec.rb
index 8605da5..dcd5cfc 100644
--- a/spec/models/solidus_subscriptions/failure_dispatcher_spec.rb
+++ b/spec/models/solidus_subscriptions/failure_dispatcher_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::FailureDispatcher do
let(:dispatcher) { described_class.new(installments, order) }
diff --git a/spec/models/solidus_subscriptions/installment_detail_spec.rb b/spec/models/solidus_subscriptions/installment_detail_spec.rb
index 78d99c2..f00a0e0 100644
--- a/spec/models/solidus_subscriptions/installment_detail_spec.rb
+++ b/spec/models/solidus_subscriptions/installment_detail_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::InstallmentDetail, type: :model do
it { is_expected.to belong_to :installment }
diff --git a/spec/models/solidus_subscriptions/installment_spec.rb b/spec/models/solidus_subscriptions/installment_spec.rb
index cfc7151..509ce29 100644
--- a/spec/models/solidus_subscriptions/installment_spec.rb
+++ b/spec/models/solidus_subscriptions/installment_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::Installment, type: :model do
it { is_expected.to have_many :details }
diff --git a/spec/models/solidus_subscriptions/line_item_builder_spec.rb b/spec/models/solidus_subscriptions/line_item_builder_spec.rb
index 510b421..b05c34a 100644
--- a/spec/models/solidus_subscriptions/line_item_builder_spec.rb
+++ b/spec/models/solidus_subscriptions/line_item_builder_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::LineItemBuilder do
let(:builder) { described_class.new subscription_line_items }
diff --git a/spec/models/solidus_subscriptions/line_item_spec.rb b/spec/models/solidus_subscriptions/line_item_spec.rb
index a836c0d..7ca2475 100644
--- a/spec/models/solidus_subscriptions/line_item_spec.rb
+++ b/spec/models/solidus_subscriptions/line_item_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::LineItem, type: :model do
it { is_expected.to belong_to :spree_line_item }
diff --git a/spec/models/solidus_subscriptions/order_builder_spec.rb b/spec/models/solidus_subscriptions/order_builder_spec.rb
index 5bcabe0..07f5d3b 100644
--- a/spec/models/solidus_subscriptions/order_builder_spec.rb
+++ b/spec/models/solidus_subscriptions/order_builder_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::OrderBuilder do
let(:builder) { described_class.new order }
diff --git a/spec/models/solidus_subscriptions/out_of_stock_dispatcher_spec.rb b/spec/models/solidus_subscriptions/out_of_stock_dispatcher_spec.rb
index d1ee92e..5108d2f 100644
--- a/spec/models/solidus_subscriptions/out_of_stock_dispatcher_spec.rb
+++ b/spec/models/solidus_subscriptions/out_of_stock_dispatcher_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::OutOfStockDispatcher do
let(:dispatcher) { described_class.new(installments) }
diff --git a/spec/models/solidus_subscriptions/payment_failed_dispatcher_spec.rb b/spec/models/solidus_subscriptions/payment_failed_dispatcher_spec.rb
index 88050b3..1a79ce1 100644
--- a/spec/models/solidus_subscriptions/payment_failed_dispatcher_spec.rb
+++ b/spec/models/solidus_subscriptions/payment_failed_dispatcher_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::PaymentFailedDispatcher do
let(:dispatcher) { described_class.new(installments, order) }
diff --git a/spec/models/solidus_subscriptions/subscription_generator_spec.rb b/spec/models/solidus_subscriptions/subscription_generator_spec.rb
index 4d9cae5..e35d744 100644
--- a/spec/models/solidus_subscriptions/subscription_generator_spec.rb
+++ b/spec/models/solidus_subscriptions/subscription_generator_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::SubscriptionGenerator do
describe '.activate' do
diff --git a/spec/models/solidus_subscriptions/subscription_order_promotion_rule_spec.rb b/spec/models/solidus_subscriptions/subscription_order_promotion_rule_spec.rb
index e05d6d5..847ab0c 100644
--- a/spec/models/solidus_subscriptions/subscription_order_promotion_rule_spec.rb
+++ b/spec/models/solidus_subscriptions/subscription_order_promotion_rule_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::SubscriptionOrderPromotionRule do
let(:rule) { described_class.new }
diff --git a/spec/models/solidus_subscriptions/subscription_promotion_rule_spec.rb b/spec/models/solidus_subscriptions/subscription_promotion_rule_spec.rb
index a2ce07e..a61239c 100644
--- a/spec/models/solidus_subscriptions/subscription_promotion_rule_spec.rb
+++ b/spec/models/solidus_subscriptions/subscription_promotion_rule_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::SubscriptionPromotionRule do
let(:rule) { described_class.new }
diff --git a/spec/models/solidus_subscriptions/subscription_spec.rb b/spec/models/solidus_subscriptions/subscription_spec.rb
index f64eabb..93e2134 100644
--- a/spec/models/solidus_subscriptions/subscription_spec.rb
+++ b/spec/models/solidus_subscriptions/subscription_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::Subscription, type: :model do
it { is_expected.to have_many :installments }
diff --git a/spec/models/solidus_subscriptions/success_dispatcher_spec.rb b/spec/models/solidus_subscriptions/success_dispatcher_spec.rb
index ebcf1ff..ef7d255 100644
--- a/spec/models/solidus_subscriptions/success_dispatcher_spec.rb
+++ b/spec/models/solidus_subscriptions/success_dispatcher_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe SolidusSubscriptions::SuccessDispatcher do
let(:dispatcher) { described_class.new(installments) }
diff --git a/spec/models/spree/variant_spec.rb b/spec/models/spree/variant_spec.rb
index 0be31a3..d1aff3d 100644
--- a/spec/models/spree/variant_spec.rb
+++ b/spec/models/spree/variant_spec.rb
@@ -1,4 +1,4 @@
-require "rails_helper"
+require 'spec_helper'
RSpec.describe Spree::Variant, type: :model do
let(:variant) { build_stubbed :variant }
diff --git a/spec/overrides/spree/line_items/subscription_line_items_association_spec.rb b/spec/overrides/spree/line_items/subscription_line_items_association_spec.rb
index 0d5a871..8d55605 100644
--- a/spec/overrides/spree/line_items/subscription_line_items_association_spec.rb
+++ b/spec/overrides/spree/line_items/subscription_line_items_association_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe Spree::LineItems::SubscriptionLineItemsAssociation, type: :model do
subject { Spree::LineItem.new }
diff --git a/spec/overrides/spree/orders/finalize_creates_subscrptions_spec.rb b/spec/overrides/spree/orders/finalize_creates_subscrptions_spec.rb
index 9605eaf..76d6166 100644
--- a/spec/overrides/spree/orders/finalize_creates_subscrptions_spec.rb
+++ b/spec/overrides/spree/orders/finalize_creates_subscrptions_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe Spree::Orders::FinalizeCreatesSubscriptions do
describe '#finalize!' do
diff --git a/spec/overrides/spree/orders/subscription_line_items_association_spec.rb b/spec/overrides/spree/orders/subscription_line_items_association_spec.rb
index 28bd8bf..14fbf34 100644
--- a/spec/overrides/spree/orders/subscription_line_items_association_spec.rb
+++ b/spec/overrides/spree/orders/subscription_line_items_association_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe Spree::Orders::SubscriptionLineItemsAssociation, type: :model do
subject { Spree::Order.new }
diff --git a/spec/overrides/spree/users/have_many_subscriptions.rb b/spec/overrides/spree/users/have_many_subscriptions.rb
index c706919..2deccc8 100644
--- a/spec/overrides/spree/users/have_many_subscriptions.rb
+++ b/spec/overrides/spree/users/have_many_subscriptions.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require 'spec_helper'
RSpec.describe Spree::Users::HaveManySubscritptions, type: :model do
subject { Spree::User.new }
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
deleted file mode 100644
index 0e9ab14..0000000
--- a/spec/rails_helper.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-# Run Coverage report
-require 'simplecov'
-SimpleCov.start do
- add_filter 'spec/'
- add_filter 'app/overrides'
- add_filter 'lib/solidus_subscriptions/engine.rb'
- add_group 'Controllers', 'app/controllers'
- add_group 'Helpers', 'app/helpers'
- add_group 'Mailers', 'app/mailers'
- add_group 'Models', 'app/models'
- add_group 'Views', 'app/views'
- add_group 'Libraries', 'lib'
-end
-
-# This can't be 100 because some code is specific to the solidus version
-# under test.
-SimpleCov.minimum_coverage 90
-
-# Configure Rails Environment
-ENV['RAILS_ENV'] = 'test'
-
-require File.expand_path('../dummy/config/environment.rb', __FILE__)
-
-require 'rspec/rails'
-require 'rspec/active_model/mocks'
-require 'database_cleaner'
-require 'ffaker'
-require 'pry'
-require 'timecop'
-
-# Requires supporting ruby files with custom matchers and macros, etc,
-# in spec/support/ and its subdirectories.
-Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
-
-# Requires factories and other useful helpers defined in spree_core.
-require 'spree/testing_support/authorization_helpers'
-require 'spree/testing_support/capybara_ext'
-require 'spree/testing_support/controller_requests'
-require 'spree/testing_support/factories'
-require 'spree/testing_support/url_helpers'
-
-# Requires factories defined in lib/solidus_subscriptions/factories.rb
-require 'solidus_subscriptions/testing_support/factories'
-
-require 'spec_helper'
-require 'shoulda-matchers'
-Shoulda::Matchers.configure do |config|
- config.integrate do |with|
- with.test_framework :rspec
- with.library :rails
- end
-end
diff --git a/spec/requests/solidus_subscriptions/api/v1/subscriptions_spec.rb b/spec/requests/solidus_subscriptions/api/v1/subscriptions_spec.rb
index 5d90985..6167081 100644
--- a/spec/requests/solidus_subscriptions/api/v1/subscriptions_spec.rb
+++ b/spec/requests/solidus_subscriptions/api/v1/subscriptions_spec.rb
@@ -1,4 +1,4 @@
-require "rails_helper"
+require 'spec_helper'
RSpec.describe "Subscription endpoints", type: :request do
let(:json_resp) { JSON.parse(response.body) }
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index a54d9f7..c9a88bc 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,65 +1,11 @@
-Dir[File.join(File.dirname(__FILE__), 'helpers/**/*.rb')].each { |f| require f }
+# frozen_string_literal: true
-FactoryBot.use_parent_strategy = false
+ENV['RAILS_ENV'] ||= 'test'
-RSpec.configure do |config|
- config.include FactoryBot::Syntax::Methods
+require 'solidus_extension_dev_tools/rspec/coverage'
- # Infer an example group's spec type from the file location.
- config.infer_spec_type_from_file_location!
+require File.expand_path('dummy/config/environment.rb', __dir__)
- # == URL Helpers
- #
- # Allows access to Spree's routes in specs:
- #
- # visit spree.admin_path
- # current_path.should eql(spree.products_path)
- config.include Spree::TestingSupport::UrlHelpers
+require 'solidus_extension_dev_tools/rspec/feature_helper'
- config.extend CheckoutInfrastructure, :checkout
-
- if defined?(VersionCake::TestHelpers)
- config.include VersionCake::TestHelpers, type: :controller
- config.before(:each, type: :controller) do
- set_request_version('', 1)
- end
- end
-
- # == Mock Framework
- #
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
- #
- # config.mock_with :mocha
- # config.mock_with :flexmock
- # config.mock_with :rr
- config.mock_with :rspec
- config.color = true
-
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
-
- # Capybara javascript drivers require transactional fixtures set to false, and we use DatabaseCleaner
- # to cleanup after each test instead. Without transactional fixtures set to false the records created
- # to setup a test will be unavailable to the browser, which runs under a separate server instance.
- config.use_transactional_fixtures = false
-
- # Ensure Suite is set to use transactions for speed.
- config.before :suite do
- DatabaseCleaner.strategy = :transaction
- DatabaseCleaner.clean_with :truncation
- end
-
- # Before each spec check if it is a Javascript test and switch between using database transactions or not where necessary.
- config.before :each do
- DatabaseCleaner.strategy = RSpec.current_example.metadata[:js] ? :truncation : :transaction
- DatabaseCleaner.start
- end
-
- # After each spec clean the database.
- config.after :each do
- DatabaseCleaner.clean
- end
-
- config.fail_fast = ENV['FAIL_FAST'] || false
- config.order = 'random'
-end
+Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
diff --git a/spec/support/active_model_mocks.rb b/spec/support/active_model_mocks.rb
new file mode 100644
index 0000000..8ee2090
--- /dev/null
+++ b/spec/support/active_model_mocks.rb
@@ -0,0 +1 @@
+require 'rspec/active_model/mocks'
diff --git a/spec/support/factories.rb b/spec/support/factories.rb
new file mode 100644
index 0000000..cb10a31
--- /dev/null
+++ b/spec/support/factories.rb
@@ -0,0 +1,3 @@
+require 'solidus_subscriptions/testing_support/factories'
+
+FactoryBot.use_parent_strategy = false
diff --git a/spec/helpers/checkout_infrastructure.rb b/spec/support/helpers/checkout_infrastructure.rb
index c41c01b..6a18083 100644
--- a/spec/helpers/checkout_infrastructure.rb
+++ b/spec/support/helpers/checkout_infrastructure.rb
@@ -16,3 +16,7 @@ module CheckoutInfrastructure
end
end
end
+
+RSpec.configure do |config|
+ config.extend CheckoutInfrastructure, :checkout
+end
diff --git a/spec/support/shoulda.rb b/spec/support/shoulda.rb
new file mode 100644
index 0000000..2e087cf
--- /dev/null
+++ b/spec/support/shoulda.rb
@@ -0,0 +1,7 @@
+require 'shoulda-matchers'
+Shoulda::Matchers.configure do |config|
+ config.integrate do |with|
+ with.test_framework :rspec
+ with.library :rails
+ end
+end
diff --git a/spec/support/timecop.rb b/spec/support/timecop.rb
new file mode 100644
index 0000000..cb435ae
--- /dev/null
+++ b/spec/support/timecop.rb
@@ -0,0 +1 @@
+require 'timecop'
diff --git a/spec/support/version_cake.rb b/spec/support/version_cake.rb
new file mode 100644
index 0000000..8bfa6f9
--- /dev/null
+++ b/spec/support/version_cake.rb
@@ -0,0 +1,8 @@
+RSpec.configure do |config|
+ if defined?(VersionCake::TestHelpers)
+ config.include VersionCake::TestHelpers, type: :controller
+ config.before(:each, type: :controller) do
+ set_request_version('', 1)
+ end
+ end
+end