Set up specs to use spork for faster test runs (#157)
This commit is contained in:
parent
b23f2697e9
commit
408ff098ba
2
Gemfile
2
Gemfile
@ -72,7 +72,7 @@ group :test do
|
|||||||
gem 'capybara'
|
gem 'capybara'
|
||||||
gem 'database_cleaner'
|
gem 'database_cleaner'
|
||||||
|
|
||||||
gem 'spork'
|
gem 'spork', '~> 0.9.0.rc'
|
||||||
gem 'launchy'
|
gem 'launchy'
|
||||||
gem 'mocha', :git => 'git://github.com/floehopper/mocha.git'
|
gem 'mocha', :git => 'git://github.com/floehopper/mocha.git'
|
||||||
end
|
end
|
||||||
|
@ -261,7 +261,7 @@ GEM
|
|||||||
ffi (>= 1.0.7)
|
ffi (>= 1.0.7)
|
||||||
json_pure
|
json_pure
|
||||||
rubyzip
|
rubyzip
|
||||||
spork (0.8.5)
|
spork (0.9.0.rc9)
|
||||||
term-ansicolor (1.0.6)
|
term-ansicolor (1.0.6)
|
||||||
thor (0.14.6)
|
thor (0.14.6)
|
||||||
treetop (1.4.9)
|
treetop (1.4.9)
|
||||||
@ -330,7 +330,7 @@ DEPENDENCIES
|
|||||||
ruby-debug19
|
ruby-debug19
|
||||||
rubyzip
|
rubyzip
|
||||||
sass (= 3.1.2)
|
sass (= 3.1.2)
|
||||||
spork
|
spork (~> 0.9.0.rc)
|
||||||
unicorn
|
unicorn
|
||||||
warden
|
warden
|
||||||
will_paginate
|
will_paginate
|
||||||
|
3
doc/changelogs/20110812.txt
Normal file
3
doc/changelogs/20110812.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
- implement the reverse has_many feature based on the great work of Alex Sanford (#142)
|
||||||
|
- fix a couple of bugs: #152
|
||||||
|
- improve the installation procedure about setting carrierwave up (#144)
|
@ -1,3 +1,9 @@
|
|||||||
|
# Note: if segmentation fault with spork / imagemagick on mac os x, take a look at:
|
||||||
|
# http://stackoverflow.com/questions/2838307/why-is-this-rmagick-call-generating-a-segmentation-fault
|
||||||
|
|
||||||
|
require 'rubygems'
|
||||||
|
require 'spork'
|
||||||
|
|
||||||
# figure out where we are being loaded from
|
# figure out where we are being loaded from
|
||||||
if $LOADED_FEATURES.grep(/spec\/spec_helper\.rb/).any?
|
if $LOADED_FEATURES.grep(/spec\/spec_helper\.rb/).any?
|
||||||
begin
|
begin
|
||||||
@ -21,41 +27,32 @@ if $LOADED_FEATURES.grep(/spec\/spec_helper\.rb/).any?
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
|
||||||
ENV["RAILS_ENV"] ||= 'test'
|
|
||||||
require File.expand_path('../../config/environment', __FILE__)
|
|
||||||
|
|
||||||
require 'rspec/rails'
|
Spork.prefork do
|
||||||
require 'factory_girl'
|
# Loading more in this block will cause your tests to run faster. However,
|
||||||
|
# if you change any configuration or code from libraries loaded here, you'll
|
||||||
|
# need to restart spork for it take effect.
|
||||||
|
|
||||||
FactoryGirl.find_definitions
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||||
|
ENV["RAILS_ENV"] ||= 'test'
|
||||||
|
require File.expand_path('../../config/environment', __FILE__)
|
||||||
|
|
||||||
# Requires supporting ruby files with custom matchers and macros, etc,
|
require 'rspec/rails'
|
||||||
# in spec/support/ and its subdirectories.
|
require 'factory_girl'
|
||||||
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
|
||||||
|
|
||||||
Locomotive.configure_for_test
|
FactoryGirl.find_definitions
|
||||||
|
|
||||||
RSpec.configure do |config|
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
||||||
|
# in spec/support/ and its subdirectories.
|
||||||
|
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
||||||
|
|
||||||
|
Locomotive.configure_for_test
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
|
||||||
config.include(Locomotive::RSpec::Matchers)
|
config.include(Locomotive::RSpec::Matchers)
|
||||||
|
|
||||||
# == Mock Framework
|
|
||||||
#
|
|
||||||
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
|
||||||
#
|
|
||||||
config.mock_with :mocha
|
config.mock_with :mocha
|
||||||
# config.mock_with :flexmock
|
|
||||||
# config.mock_with :rr
|
|
||||||
# config.mock_with :rspec
|
|
||||||
|
|
||||||
# Remove this line if you're not using ActiveRecord or ActiveRecord 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.before(:each) do
|
config.before(:each) do
|
||||||
Locomotive.config.heroku = false
|
Locomotive.config.heroku = false
|
||||||
@ -78,4 +75,15 @@ RSpec.configure do |config|
|
|||||||
DatabaseCleaner.clean
|
DatabaseCleaner.clean
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
Spork.each_run do
|
||||||
|
# This code will be run each time you run your specs.
|
||||||
|
Locomotive.configure_for_test(true)
|
||||||
|
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
||||||
|
|
||||||
|
# loading ruby file directly breaks the tests
|
||||||
|
# Dir[Rails.root.join('app/models/*.rb')].each { |f| load f }
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user