Optimize execution duration for rspec specs
* Use in memory sqlite database for test environment * Monkey patch BCrypt default cost factor * Clean spec/spec_helper.rb
This commit is contained in:
parent
47b4f7ac83
commit
7187266982
@ -11,7 +11,7 @@ development:
|
|||||||
# Do not set this db to the same as development or production.
|
# Do not set this db to the same as development or production.
|
||||||
test: &test
|
test: &test
|
||||||
adapter: sqlite3
|
adapter: sqlite3
|
||||||
database: db/test.sqlite3
|
database: ':memory:'
|
||||||
pool: 5
|
pool: 5
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
|
|
||||||
@ -22,4 +22,4 @@ production:
|
|||||||
timeout: 5000
|
timeout: 5000
|
||||||
|
|
||||||
cucumber:
|
cucumber:
|
||||||
<<: *test
|
<<: *test
|
||||||
|
@ -48,3 +48,5 @@ end
|
|||||||
# DatabaseCleaner.strategy = :transaction
|
# DatabaseCleaner.strategy = :transaction
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
|
|
||||||
|
load "#{Rails.root.to_s}/db/schema.rb"
|
||||||
|
@ -1,27 +1,16 @@
|
|||||||
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||||
ENV["RAILS_ENV"] ||= 'test'
|
ENV['RAILS_ENV'] ||= 'test'
|
||||||
require File.expand_path("../../config/environment", __FILE__)
|
require File.expand_path('../../config/environment', __FILE__)
|
||||||
require 'rspec/rails'
|
require 'rspec/rails'
|
||||||
|
|
||||||
# Requires supporting ruby files with custom matchers and macros, etc,
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
||||||
# in spec/support/ and its subdirectories.
|
# in spec/support/ and its subdirectories.
|
||||||
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
Dir[Rails.root.join('spec/support/**/*.rb')].each {|f| require f}
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
# == 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.mock_with :rspec
|
||||||
|
|
||||||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
||||||
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||||
|
|
||||||
# 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
|
config.use_transactional_fixtures = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
load "#{Rails.root.to_s}/db/schema.rb"
|
||||||
|
8
spec/support/decrease_bcrypt_cost_factor.rb
Normal file
8
spec/support/decrease_bcrypt_cost_factor.rb
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
module BCrypt
|
||||||
|
class Engine
|
||||||
|
[:DEFAULT_COST, :MIN_COST].each do |sym|
|
||||||
|
remove_const sym
|
||||||
|
const_set sym, 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user