fixed some issues with test runners calling out the the command line which was creating unexpected results

This commit is contained in:
Scott Davis 2011-12-11 01:31:54 -05:00
parent 684ad8754a
commit 89de5cb492
5 changed files with 24 additions and 10 deletions

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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'

View File

@ -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)