2009-11-19 10:26:35 +00:00
|
|
|
require 'test_helper'
|
2009-01-19 15:53:51 +00:00
|
|
|
require 'fileutils'
|
|
|
|
require 'compass'
|
|
|
|
require 'compass/exec'
|
2009-01-19 18:05:59 +00:00
|
|
|
require 'timeout'
|
2009-01-19 15:53:51 +00:00
|
|
|
|
|
|
|
class CommandLineTest < Test::Unit::TestCase
|
|
|
|
include Compass::TestCaseHelper
|
2009-06-12 18:00:04 +00:00
|
|
|
include Compass::CommandLineHelper
|
2009-08-25 21:18:58 +00:00
|
|
|
include Compass::IoHelper
|
2009-02-04 16:09:13 +00:00
|
|
|
|
|
|
|
def teardown
|
2009-08-25 21:18:58 +00:00
|
|
|
Compass.reset_configuration!
|
2009-02-04 16:09:13 +00:00
|
|
|
end
|
|
|
|
|
2009-04-07 07:11:54 +00:00
|
|
|
def test_print_version
|
|
|
|
compass "-vq"
|
|
|
|
assert_match /\d+\.\d+\.\d+( [0-9a-f]+)?/, @last_result
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_list_frameworks
|
|
|
|
compass "--list-frameworks"
|
2009-08-29 21:52:30 +00:00
|
|
|
assert_equal(%w(blueprint compass), @last_result.split.sort)
|
2009-04-07 07:11:54 +00:00
|
|
|
end
|
|
|
|
|
2009-01-19 15:53:51 +00:00
|
|
|
def test_basic_install
|
|
|
|
within_tmp_directory do
|
|
|
|
compass "basic"
|
|
|
|
assert File.exists?("basic/src/screen.sass")
|
|
|
|
assert File.exists?("basic/stylesheets/screen.css")
|
|
|
|
assert_action_performed :directory, "basic/"
|
|
|
|
assert_action_performed :create, "basic/src/screen.sass"
|
|
|
|
assert_action_performed :compile, "basic/src/screen.sass"
|
|
|
|
assert_action_performed :create, "basic/stylesheets/screen.css"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_framework_installs
|
|
|
|
Compass::Frameworks::ALL.each do |framework|
|
|
|
|
within_tmp_directory do
|
|
|
|
compass *%W(--framework #{framework.name} #{framework.name}_project)
|
|
|
|
assert File.exists?("#{framework.name}_project/src/screen.sass")
|
|
|
|
assert File.exists?("#{framework.name}_project/stylesheets/screen.css")
|
|
|
|
assert_action_performed :directory, "#{framework.name}_project/"
|
|
|
|
assert_action_performed :create, "#{framework.name}_project/src/screen.sass"
|
|
|
|
assert_action_performed :compile, "#{framework.name}_project/src/screen.sass"
|
|
|
|
assert_action_performed :create, "#{framework.name}_project/stylesheets/screen.css"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_basic_update
|
|
|
|
within_tmp_directory do
|
|
|
|
compass "basic"
|
|
|
|
Dir.chdir "basic" do
|
2009-05-07 19:29:06 +00:00
|
|
|
# basic update with timestamp caching
|
2009-01-19 15:53:51 +00:00
|
|
|
compass
|
2009-05-07 19:29:06 +00:00
|
|
|
assert_action_performed :unchanged, "src/screen.sass"
|
|
|
|
# basic update with force option set
|
|
|
|
compass "--force"
|
2009-01-19 15:53:51 +00:00
|
|
|
assert_action_performed :compile, "src/screen.sass"
|
2009-02-08 11:21:08 +00:00
|
|
|
assert_action_performed :identical, "stylesheets/screen.css"
|
2009-01-19 15:53:51 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-11-19 10:26:35 +00:00
|
|
|
end
|