diff --git a/Gemfile b/Gemfile index 649961aa..6f5eb63b 100644 --- a/Gemfile +++ b/Gemfile @@ -2,9 +2,9 @@ source :rubygems gemspec -gem "cucumber", "~> 1.1.0" +gem "cucumber", "~> 1.1.4" gem "rspec", "~>2.0.0" -gem "rails", "~>3.0.0.rc" +gem "rails", "~> 3.1" gem "compass-validator", "3.0.1" gem "css_parser", "~> 1.0.1" gem "sass", "~> 3.1" diff --git a/features/extensions.feature b/features/extensions.feature index 1f1a979c..a4f15803 100644 --- a/features/extensions.feature +++ b/features/extensions.feature @@ -15,7 +15,7 @@ Feature: Extensions @listframeworks Scenario: Extensions directory for rails projects Given ruby supports fork - And I'm in a newly created rails project: my_rails_project + And I'm in a newly created rails project: extension_test_rails_project And I run: compass init rails And the "vendor/plugins/compass_extensions" directory exists And and I have a fake extension at vendor/plugins/compass_extensions/testing diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 8a0eb25b..534bbcec 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -42,10 +42,11 @@ Given %r{^I am in the parent directory$} do end Given %r{^I'm in a newly created rails project: (.+)$} do |project_name| - @cleanup_directories << project_name + dir = File.join(Dir.pwd, project_name) + @cleanup_directories << dir begin - generate_rails_app project_name - Dir.chdir project_name + generate_rails_app project_name, Dir.pwd + Dir.chdir dir rescue LoadError pending "Missing Ruby-on-rails gems: sudo gem install rails" end diff --git a/test/helpers/rails.rb b/test/helpers/rails.rb index 12c60c0f..614322a8 100644 --- a/test/helpers/rails.rb +++ b/test/helpers/rails.rb @@ -10,7 +10,7 @@ module Compass # Generate a rails application without polluting our current set of requires # with the rails libraries. This will allow testing against multiple versions of rails # by manipulating the load path. - def generate_rails_app(name) + def generate_rails_app(name, dir = nil) if pid = fork Process.wait(pid) if $?.exitstatus == 2 @@ -22,7 +22,16 @@ module Compass begin require 'action_pack/version' if ActionPack::VERSION::MAJOR >= 3 - `rails new #{name}` + require 'rails/generators' + require 'rails/generators/rails/app/app_generator' + require 'mocha' + dir ||= File.join(File.expand_path('../../', __FILE__)) + args = [File.join(dir, name), '-q', '-f', '--skip-bundle', '--skip-gemfile'] + + #stub this so you can generate more apps + Rails::Generators::AppGenerator.any_instance.stubs(:valid_const?).returns(true) + Rails::Generators::AppGenerator.start(args, {:destination_root => dir}) + else require 'rails/version' require 'rails_generator' diff --git a/test/units/sprites/sprite_command_test.rb b/test/units/sprites/sprite_command_test.rb index 4e4354fb..b1242b66 100644 --- a/test/units/sprites/sprite_command_test.rb +++ b/test/units/sprites/sprite_command_test.rb @@ -1,6 +1,10 @@ require 'test_helper' - +require 'compass/exec' class SpriteCommandTest < Test::Unit::TestCase + include Compass::TestCaseHelper + include Compass::CommandLineHelper + include Compass::IoHelper + attr_reader :test_dir include SpriteHelper def setup @@ -27,7 +31,7 @@ class SpriteCommandTest < Test::Unit::TestCase def run_compass_with_options(options) output = 'foo' ::Dir.chdir @test_dir - %x{compass #{options.join(' ')}} + compass *options end def options_to_cli(options)