From 46f97aaad72e97e673fccfb6b7dcbf2c1c668cdc Mon Sep 17 00:00:00 2001 From: Kurtis Rainbolt-Greene Date: Sat, 23 May 2015 20:24:23 -0500 Subject: [PATCH] rspec-rails ~> 3.2 uses rails_helper fixes #668 As of rspec-rails 3.2 they generate two files: - spec/spec_helper.rb - spec/rails_helper.rb This allows the user to either do pure ruby unit tests or include the entire rails environment. Draper really only works in a rails application if it has the rails environment. This matches ~> 3.2 and uses the rails_helper instead of spec_helper. --- lib/generators/rspec/templates/decorator_spec.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/generators/rspec/templates/decorator_spec.rb b/lib/generators/rspec/templates/decorator_spec.rb index 6acbd52..e15e832 100644 --- a/lib/generators/rspec/templates/decorator_spec.rb +++ b/lib/generators/rspec/templates/decorator_spec.rb @@ -1,4 +1,9 @@ -require 'spec_helper' +<% if RSpec::Rails::Version::STRING.match(/\A3\.[^10]/) %> + require 'rails_helper' +<% else %> + require 'spec_helper' +<% end %> describe <%= class_name %>Decorator do + end