Use spork instead of spring
This commit is contained in:
parent
f80dddba6a
commit
2d4e7e59a6
5 changed files with 68 additions and 21 deletions
2
.rspec
Normal file
2
.rspec
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
--color
|
||||||
|
--drb
|
4
Gemfile
4
Gemfile
|
@ -22,10 +22,10 @@ gem 'jbuilder', '~> 1.2'
|
||||||
gem 'bootstrap-sass'
|
gem 'bootstrap-sass'
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
gem 'spring'
|
gem 'spork'
|
||||||
gem 'rspec-rails'
|
gem 'rspec-rails'
|
||||||
|
|
||||||
gem 'guard-spring'
|
gem 'guard-spork'
|
||||||
gem 'guard-rspec'
|
gem 'guard-rspec'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
13
Gemfile.lock
13
Gemfile.lock
|
@ -67,9 +67,10 @@ GEM
|
||||||
guard-rspec (4.2.5)
|
guard-rspec (4.2.5)
|
||||||
guard (~> 2.1)
|
guard (~> 2.1)
|
||||||
rspec (>= 2.14, < 4.0)
|
rspec (>= 2.14, < 4.0)
|
||||||
guard-spring (0.0.4)
|
guard-spork (1.5.0)
|
||||||
guard
|
childprocess (>= 0.2.3)
|
||||||
spring
|
guard (>= 1.1)
|
||||||
|
spork (>= 0.8.4)
|
||||||
hike (1.2.3)
|
hike (1.2.3)
|
||||||
i18n (0.6.9)
|
i18n (0.6.9)
|
||||||
jbuilder (1.5.3)
|
jbuilder (1.5.3)
|
||||||
|
@ -154,7 +155,7 @@ GEM
|
||||||
rubyzip (~> 1.0)
|
rubyzip (~> 1.0)
|
||||||
websocket (~> 1.0.4)
|
websocket (~> 1.0.4)
|
||||||
slop (3.4.7)
|
slop (3.4.7)
|
||||||
spring (1.1.0)
|
spork (1.0.0rc4)
|
||||||
sprockets (2.10.1)
|
sprockets (2.10.1)
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
|
@ -193,7 +194,7 @@ DEPENDENCIES
|
||||||
coffee-rails (~> 4.0.0)
|
coffee-rails (~> 4.0.0)
|
||||||
factory_girl_rails
|
factory_girl_rails
|
||||||
guard-rspec
|
guard-rspec
|
||||||
guard-spring
|
guard-spork
|
||||||
jbuilder (~> 1.2)
|
jbuilder (~> 1.2)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
libnotify
|
libnotify
|
||||||
|
@ -202,7 +203,7 @@ DEPENDENCIES
|
||||||
sass-rails (~> 4.0.0)
|
sass-rails (~> 4.0.0)
|
||||||
sdoc
|
sdoc
|
||||||
selenium-webdriver
|
selenium-webdriver
|
||||||
spring
|
spork
|
||||||
sqlite3
|
sqlite3
|
||||||
terminal-notifier-guard
|
terminal-notifier-guard
|
||||||
turbolinks
|
turbolinks
|
||||||
|
|
46
Guardfile
46
Guardfile
|
@ -1,17 +1,8 @@
|
||||||
# A sample Guardfile
|
# A sample Guardfile
|
||||||
# More info at https://github.com/guard/guard#readme
|
# More info at https://github.com/guard/guard#readme
|
||||||
|
require 'active_support/inflector'
|
||||||
|
|
||||||
guard 'spring', :rspec_cli => '--color' do
|
guard 'rspec', all_after_pass: false, cli: '--drb' do
|
||||||
watch(%r{^spec/.+_spec\.rb$})
|
|
||||||
watch(%r{^spec/spec_helper\.rb$}) { |m| 'spec' }
|
|
||||||
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
|
||||||
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
|
||||||
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) do |m|
|
|
||||||
%W(spec/routing/#{m[1]}_routing_spec.rb spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb spec/requests/#{m[1]}_spec.rb)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
guard :rspec do
|
|
||||||
if RUBY_PLATFORM.include?('linux')
|
if RUBY_PLATFORM.include?('linux')
|
||||||
notification :libnotify, :timeout => 5, :transient => true,
|
notification :libnotify, :timeout => 5, :transient => true,
|
||||||
:append => false, :urgency => :critical
|
:append => false, :urgency => :critical
|
||||||
|
@ -23,20 +14,49 @@ guard :rspec do
|
||||||
watch(%r{^spec/.+_spec\.rb$})
|
watch(%r{^spec/.+_spec\.rb$})
|
||||||
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
||||||
watch('spec/spec_helper.rb') { "spec" }
|
watch('spec/spec_helper.rb') { "spec" }
|
||||||
|
watch('spec/factories.rb') { "spec" }
|
||||||
|
|
||||||
# Rails example
|
# Rails example
|
||||||
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
||||||
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
||||||
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
||||||
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
||||||
watch('config/routes.rb') { "spec/routing" }
|
watch('config/routes.rb') { "spec/routing" }
|
||||||
|
|
||||||
|
# Custom Rails Tutorial specs
|
||||||
|
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) do |m|
|
||||||
|
["spec/routing/#{m[1]}_routing_spec.rb",
|
||||||
|
"spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb",
|
||||||
|
"spec/acceptance/#{m[1]}_spec.rb",
|
||||||
|
(m[1][/_pages/] ? "spec/requests/#{m[1]}_spec.rb" :
|
||||||
|
"spec/requests/#{m[1].singularize}_pages_spec.rb")]
|
||||||
|
end
|
||||||
|
watch(%r{^app/views/(.+)/}) do |m|
|
||||||
|
(m[1][/_pages/] ? "spec/requests/#{m[1]}_spec.rb" :
|
||||||
|
"spec/requests/#{m[1].singularize}_pages_spec.rb")
|
||||||
|
end
|
||||||
|
watch(%r{^app/controllers/sessions_controller\.rb$}) do |m|
|
||||||
|
"spec/requests/authentication_pages_spec.rb"
|
||||||
|
end
|
||||||
|
|
||||||
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
||||||
|
|
||||||
# Capybara features specs
|
# Capybara features specs
|
||||||
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
||||||
|
|
||||||
# Turnip features and steps
|
# Turnip features and steps
|
||||||
watch(%r{^spec/acceptance/(.+)\.feature$})
|
watch(%r{^spec/acceptance/(.+)\.feature$})
|
||||||
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
guard 'spork', rspec_env: { 'RAILS_ENV' => 'test' }, test_unit: false do
|
||||||
|
watch('config/application.rb')
|
||||||
|
watch('config/environment.rb')
|
||||||
|
watch('config/environments/test.rb')
|
||||||
|
watch(%r{^config/initializers/.+\.rb$})
|
||||||
|
watch('Gemfile')
|
||||||
|
watch('Gemfile.lock')
|
||||||
|
watch('spec/spec_helper.rb') { :rspec }
|
||||||
|
watch('test/test_helper.rb') { :test_unit }
|
||||||
|
end
|
||||||
|
|
|
@ -1 +1,25 @@
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
|
require 'spork'
|
||||||
|
|
||||||
|
Spork.prefork do
|
||||||
|
ENV["RAILS_ENV"] ||= 'test'
|
||||||
|
require File.expand_path("../../config/environment", __FILE__)
|
||||||
|
require 'rspec/rails'
|
||||||
|
require 'rspec/autorun'
|
||||||
|
|
||||||
|
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
||||||
|
|
||||||
|
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||||
|
config.use_transactional_fixtures = true
|
||||||
|
config.infer_base_class_for_anonymous_controllers = false
|
||||||
|
config.order = "random"
|
||||||
|
config.include Capybara::DSL
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Spork.each_run do
|
||||||
|
FactoryGirl.reload
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in a new issue