Fix some test errors that occur when gems are missing.

This commit is contained in:
Chris Eppstein 2009-10-30 08:13:25 -07:00
parent 2675f8ed9a
commit b0637be654
5 changed files with 20 additions and 8 deletions

View File

@ -36,8 +36,12 @@ end
Given /^I'm in a newly created rails project: (.+)$/ do |project_name| Given /^I'm in a newly created rails project: (.+)$/ do |project_name|
@cleanup_directories << project_name @cleanup_directories << project_name
generate_rails_app project_name begin
Dir.chdir project_name generate_rails_app project_name
Dir.chdir project_name
rescue LoadError
pending "Missing Ruby-on-rails gems: sudo gem install rails"
end
end end
# When Actions are performed # When Actions are performed
@ -173,7 +177,11 @@ Then /^the following configuration properties are set in ([^ ]+):$/ do |config_f
end end
Then /^my css is validated$/ do Then /^my css is validated$/ do
@last_result.should =~ /Compass CSS Validator/ if @last_error =~ /The Compass CSS Validator could not be loaded/
pending "Missing Dependency: sudo gem install chriseppstein-compass-validator"
else
@last_result.should =~ /Compass CSS Validator/
end
end end
Then /^I am informed that my css is valid.$/ do Then /^I am informed that my css is valid.$/ do

View File

@ -4,4 +4,7 @@ module Compass
class FilesystemConflict < Error class FilesystemConflict < Error
end end
class MissingDependency < Error
end
end end

View File

@ -2,9 +2,8 @@ begin
require 'rubygems' require 'rubygems'
require 'compass-validator' require 'compass-validator'
rescue LoadError rescue LoadError
puts %Q{The Compass CSS Validator could not be loaded. Please install it: raise Compass::MissingDependency, %Q{The Compass CSS Validator could not be loaded. Please install it:
sudo gem install chriseppstein-compass-validator --source http://gems.github.com/ sudo gem install chriseppstein-compass-validator --source http://gems.github.com/
} }
exit(1)
end end

View File

@ -1,3 +1,5 @@
require 'timeout'
module Compass::CommandLineHelper module Compass::CommandLineHelper
def compass(*arguments) def compass(*arguments)
options = arguments.last.is_a?(Hash) ? arguments.pop : {} options = arguments.last.is_a?(Hash) ? arguments.pop : {}

View File

@ -28,7 +28,7 @@ module Compass
Rails::Generator::Scripts::Generate.new.run([name], :generator => 'app') Rails::Generator::Scripts::Generate.new.run([name], :generator => 'app')
end end
rescue LoadError rescue LoadError
Kernel.exit(2) Kernel.exit!(2)
rescue => e rescue => e
$stderr.puts e $stderr.puts e
Kernel.exit!(1) Kernel.exit!(1)