spec/spec_helper.rb in upmin-admin-0.0.39 vs spec/spec_helper.rb in upmin-admin-0.1.0
- old
+ new
@@ -5,13 +5,12 @@
require 'capybara/rspec'
require 'capybara/rails'
require 'database_cleaner'
require 'factory_girl_rails'
-
-if defined?(ActiveRecord)
- require File.expand_path('../../../../seed/seeder', __FILE__)
+if defined?(ActiveRecord) || defined?(DataMapper)
+ require File.expand_path('../../../../test_seeders/seeder', __FILE__)
end
RSpec.configure do |config|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
@@ -26,10 +25,16 @@
config.mock_with(:rspec) do |mocks|
mocks.verify_partial_doubles = true
end
config.before(:suite) do
+ if defined?(DataMapper)
+ # NOTE: eager_loading needs to be on in the app for testing.
+ DataMapper.finalize
+ DataMapper.auto_migrate!
+ end
+
Seeder.seed
end
config.after(:suite) do
end
@@ -39,13 +44,14 @@
config.after(:each) do
end
# Uncomment this if you want to the page to be saved and opened after any test failure.
- # config.after do |example|
- # if example.metadata[:type] == :feature && example.exception.present?
- # save_and_open_page
- # end
- # end
+ config.after do |example|
+ if example.metadata[:type] == :feature && example.exception.present?
+ save_and_open_page
+ end
+ end
config.include(FactoryGirl::Syntax::Methods)
+ config.include(ActionView::Helpers::NumberHelper, type: :view)
end