-
-
Save iain/788782f5db6204bd68d3 to your computer and use it in GitHub Desktop.
rspec-rails issue 31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d3cb9d8deb58bee7cbd9744f7cb950e0f0908677 Mon Sep 17 00:00:00 2001 | |
From: Iain Hecker <iain@iain.nl> | |
Date: Sat, 17 Apr 2010 17:20:46 +0200 | |
Subject: [PATCH] Use Rails module in generated files [#31 state:resolved] | |
--- | |
.../rspec/install/templates/lib/tasks/rspec.rake | 2 +- | |
.../rspec/install/templates/spec/spec_helper.rb | 2 +- | |
2 files changed, 2 insertions(+), 2 deletions(-) | |
diff --git a/lib/generators/rspec/install/templates/lib/tasks/rspec.rake b/lib/generators/rspec/install/templates/lib/tasks/rspec.rake | |
index f11f1b6..a580b8f 100644 | |
--- a/lib/generators/rspec/install/templates/lib/tasks/rspec.rake | |
+++ b/lib/generators/rspec/install/templates/lib/tasks/rspec.rake | |
@@ -28,7 +28,7 @@ end | |
Rake.application.instance_variable_get('@tasks').delete('default') | |
-spec_prereq = File.exist?(File.join(Rails.root, 'config', 'database.yml')) ? "db:test:prepare" : :noop | |
+spec_prereq = Rails.root.join('config', 'database.yml').exist? ? "db:test:prepare" : :noop | |
task :noop do | |
end | |
diff --git a/lib/generators/rspec/install/templates/spec/spec_helper.rb b/lib/generators/rspec/install/templates/spec/spec_helper.rb | |
index 7b590ab..c0cf8a9 100644 | |
--- a/lib/generators/rspec/install/templates/spec/spec_helper.rb | |
+++ b/lib/generators/rspec/install/templates/spec/spec_helper.rb | |
@@ -1,7 +1,7 @@ | |
# This file is copied to ~/spec when you run 'ruby script/generate rspec' | |
# from the project root directory. | |
ENV["RAILS_ENV"] ||= 'test' | |
-require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) | |
+require File.dirname(__FILE__) + "/../config/environment" unless defined?(Rails) | |
require 'rspec/rails' | |
# Requires supporting files with custom matchers and macros, etc, | |
-- | |
1.6.6.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment