diff --git a/Gemfile b/Gemfile index d6fa8aa3e..637fac4d0 100644 --- a/Gemfile +++ b/Gemfile @@ -64,6 +64,7 @@ group :development, :test do gem 'web-console', '~> 2.0' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' + gem 'spring-commands-rspec' gem 'rspec-rails', '~> 3.3' gem 'capybara' gem 'factory_girl_rails' diff --git a/Gemfile.lock b/Gemfile.lock index 001e73c4b..ae98d4a9d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -368,8 +368,10 @@ GEM simplecov-html (~> 0.10.0) simplecov-html (0.10.0) spring (1.4.4) - sprockets (3.4.1) + spring-commands-rspec (1.0.4) rack (> 1, < 3) + spring (>= 0.9.1) + sprockets (3.4.1) sprockets-rails (2.3.3) actionpack (>= 3.0) activesupport (>= 3.0) @@ -485,6 +487,7 @@ DEPENDENCIES simple_captcha2 social-share-button! spring + spring-commands-rspec turbolinks turnout uglifier (>= 1.3.0) diff --git a/bin/rspec b/bin/rspec index 0c86b5c6f..5a3c87c5f 100755 --- a/bin/rspec +++ b/bin/rspec @@ -1,4 +1,9 @@ #!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end # # This file was generated by Bundler. # diff --git a/bin/spring b/bin/spring index 7b45d374f..62ec28f8c 100755 --- a/bin/spring +++ b/bin/spring @@ -4,12 +4,12 @@ # It gets overwritten when you run the `spring binstub` command. unless defined?(Spring) - require "rubygems" - require "bundler" + require 'rubygems' + require 'bundler' - if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m) - Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq } - gem "spring", match[1] - require "spring/binstub" + if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)) + Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq } + gem 'spring', match[1] + require 'spring/binstub' end end