Added config to optionally disable deleting digitals on variant deletion

This commit is contained in:
Michael Bianco committed 2012-10-29 11:43:47 -04:00
1 parent c5b1b87617
commit d1536aa741
6 files changed
+47 -16

No files matched your search

+22 -3
View File
@@ -4,14 +4,18 @@ ENV["RAILS_ENV"] = "test"
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require 'rspec/rails'
require 'database_cleaner'
# 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 defined in spree_core
require 'spree/core/testing_support/env'
require 'spree/core/testing_support/factories'
Dir[File.join(File.dirname(__FILE__), "factories/*.rb")].each {|f| require f }
RSpec.configure do |config|
# == Mock Framework
#
@@ -28,10 +32,25 @@ RSpec.configure do |config|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
end
config.use_transactional_fixtures = false
Dir[File.join(File.dirname(__FILE__), "factories/*.rb")].each {|f| require f }
config.before(:each) do
if example.metadata[:js]
DatabaseCleaner.strategy = :truncation, { :except => ['spree_countries', 'spree_zones', 'spree_zone_members', 'spree_states', 'spree_roles'] }
else
DatabaseCleaner.strategy = :transaction
end
end
config.before(:each) do
DatabaseCleaner.start
# reset_spree_preferences
end
config.after(:each) do
DatabaseCleaner.clean
end
end
# not sure if this really adds anything, but this existed in the intial version of the spree_digital rspec testing
RSpec::Matchers.define :have_valid_factory do |factory_name|