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
|
2010-01-18 20:09:17 +00:00
|
|
|
compass "--boring", "basic"
|
2009-01-19 15:53:51 +00:00
|
|
|
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
|
|
|
|
|
2010-01-18 20:09:17 +00:00
|
|
|
Compass::Frameworks::ALL.each do |framework|
|
|
|
|
define_method "test_#{framework.name}_installation" do
|
2009-01-19 15:53:51 +00:00
|
|
|
within_tmp_directory do
|
2010-01-18 20:09:17 +00:00
|
|
|
compass *%W(--boring --framework #{framework.name} #{framework.name}_project)
|
|
|
|
assert File.exists?("#{framework.name}_project/src/screen.sass"), "src/screen.sass is missing. Found: #{Dir.glob("#{framework.name}_project/**/*").join(", ")}"
|
2009-01-19 15:53:51 +00:00
|
|
|
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
|
2010-01-18 20:09:17 +00:00
|
|
|
compass "--boring", "basic"
|
2009-01-19 15:53:51 +00:00
|
|
|
Dir.chdir "basic" do
|
2009-05-07 19:29:06 +00:00
|
|
|
# basic update with timestamp caching
|
2010-01-18 20:09:17 +00:00
|
|
|
compass "--boring"
|
2009-05-07 19:29:06 +00:00
|
|
|
assert_action_performed :unchanged, "src/screen.sass"
|
|
|
|
# basic update with force option set
|
2010-01-18 20:09:17 +00:00
|
|
|
compass "--force", "--boring"
|
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
|