1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
require 'test_helper'
require 'fileutils'
require 'compass'
require 'compass/exec'
require 'timeout'
class CommandLineTest < Test::Unit::TestCase
include Compass::TestCaseHelper
include Compass::CommandLineHelper
include Compass::IoHelper
def teardown
Compass.reset_configuration!
end
def test_print_version
compass "-vq"
assert_match /\d+\.\d+\.(\d+|((alpha|beta|rc)\.\d+\.[0-9a-f]+))?/, @last_result
end
def test_basic_install
within_tmp_directory do
compass "create", "--boring", "basic"
assert File.exists?("basic/sass/screen.scss")
assert File.exists?("basic/stylesheets/screen.css")
assert_action_performed :directory, "basic/"
assert_action_performed :create, "basic/sass/screen.scss"
assert_action_performed :create, "basic/stylesheets/screen.css"
end
end
Compass::Frameworks::ALL.each do |framework|
next if framework.name =~ /^_/
define_method "test_#{framework.name}_installation" do
within_tmp_directory do
compass *%W(create --boring --using #{framework.name} #{framework.name}_project)
assert File.exists?("#{framework.name}_project/sass/screen.scss"), "sass/screen.scss is missing. Found: #{Dir.glob("#{framework.name}_project/**/*").join(", ")}"
assert File.exists?("#{framework.name}_project/stylesheets/screen.css")
assert_action_performed :directory, "#{framework.name}_project/"
assert_action_performed :create, "#{framework.name}_project/sass/screen.scss"
assert_action_performed :create, "#{framework.name}_project/stylesheets/screen.css"
end
end
end
def test_basic_update
within_tmp_directory do
compass "create", "--boring", "basic"
Dir.chdir "basic" do
# basic update with timestamp caching
compass "compile", "--boring"
assert_action_performed :unchanged, "sass/screen.scss"
# basic update with force option set
compass "compile", "--force", "--boring"
assert_action_performed :identical, "stylesheets/screen.css"
end
end
end
end
|