From 13055f473108d2eb40786d52e80439637b0ab3e2 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 28 Aug 2010 13:58:08 -0700 Subject: [PATCH] Gemfiles for testing and a rails test helper that works for both rails 2 and rails 3. --- .gitignore | 1 + Gemfile | 8 ++++++++ Gemfile_rails2 | 8 ++++++++ test/rails_helper.rb | 19 ++++++++++++------- 4 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 Gemfile create mode 100644 Gemfile_rails2 diff --git a/.gitignore b/.gitignore index f04555fd..efbcad5a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.DS_Store *.tmproj +*.lock sync tmp/* examples/*/stylesheets/* diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..c78185e8 --- /dev/null +++ b/Gemfile @@ -0,0 +1,8 @@ +source :rubygems + +gem "compass", :path => "." +gem "cucumber" +gem "rspec" +gem "rails", "~>3.0.0.rc" +gem "compass-validator" +gem "css_parser" diff --git a/Gemfile_rails2 b/Gemfile_rails2 new file mode 100644 index 00000000..2af96342 --- /dev/null +++ b/Gemfile_rails2 @@ -0,0 +1,8 @@ +source :rubygems + +gem "compass", :path => "." +gem "cucumber" +gem "rspec" +gem "rails", "~>2.3" +gem "compass-validator" +gem "css_parser" diff --git a/test/rails_helper.rb b/test/rails_helper.rb index d8b47a17..11a743d9 100644 --- a/test/rails_helper.rb +++ b/test/rails_helper.rb @@ -19,13 +19,18 @@ module Compass end else begin - require 'rails/version' - require 'rails_generator' - require 'rails_generator/scripts/generate' - Rails::Generator::Base.use_application_sources! - capture_output do - Rails::Generator::Base.logger = Rails::Generator::SimpleLogger.new $stdout - Rails::Generator::Scripts::Generate.new.run([name], :generator => 'app') + require 'action_pack/version' + if ActionPack::VERSION::MAJOR >= 3 + `rails new #{name}` + else + require 'rails/version' + require 'rails_generator' + require 'rails_generator/scripts/generate' + Rails::Generator::Base.use_application_sources! + capture_output do + Rails::Generator::Base.logger = Rails::Generator::SimpleLogger.new $stdout + Rails::Generator::Scripts::Generate.new.run([name], :generator => 'app') + end end rescue LoadError Kernel.exit!(2)