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|
@cleanup_directories << project_name
begin
generate_rails_app project_name
Dir.chdir project_name
rescue LoadError
pending "Missing Ruby-on-rails gems: sudo gem install rails"
end
end
# When Actions are performed
@ -173,8 +177,12 @@ Then /^the following configuration properties are set in ([^ ]+):$/ do |config_f
end
Then /^my css is validated$/ do
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
Then /^I am informed that my css is valid.$/ do
@last_result.should =~ /Your CSS files are valid\./

View File

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

View File

@ -2,9 +2,8 @@ begin
require 'rubygems'
require 'compass-validator'
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/
}
exit(1)
end

View File

@ -1,3 +1,5 @@
require 'timeout'
module Compass::CommandLineHelper
def compass(*arguments)
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')
end
rescue LoadError
Kernel.exit(2)
Kernel.exit!(2)
rescue => e
$stderr.puts e
Kernel.exit!(1)