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"
|
2010-06-01 15:31:19 +00:00
|
|
|
assert_match /\d+\.\d+\.(\d+|((alpha|beta|rc)\.\d+\.[0-9a-f]+))?/, @last_result
|
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"
|
2010-10-31 04:59:38 +00:00
|
|
|
assert File.exists?("basic/sass/screen.scss")
|
2009-01-19 15:53:51 +00:00
|
|
|
assert File.exists?("basic/stylesheets/screen.css")
|
|
|
|
assert_action_performed :directory, "basic/"
|
2010-10-31 04:59:38 +00:00
|
|
|
assert_action_performed :create, "basic/sass/screen.scss"
|
2009-01-19 15:53:51 +00:00
|
|
|
assert_action_performed :create, "basic/stylesheets/screen.css"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-01-18 20:09:17 +00:00
|
|
|
Compass::Frameworks::ALL.each do |framework|
|
2010-04-07 16:00:49 +00:00
|
|
|
next if framework.name =~ /^_/
|
2010-01-18 20:09:17 +00:00
|
|
|
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)
|
2010-10-31 04:59:38 +00:00
|
|
|
assert File.exists?("#{framework.name}_project/sass/screen.scss"), "sass/screen.scss 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/"
|
2010-10-31 04:59:38 +00:00
|
|
|
assert_action_performed :create, "#{framework.name}_project/sass/screen.scss"
|
2009-01-19 15:53:51 +00:00
|
|
|
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"
|
2010-10-31 04:59:38 +00:00
|
|
|
assert_action_performed :unchanged, "sass/screen.scss"
|
2009-05-07 19:29:06 +00:00
|
|
|
# basic update with force option set
|
2010-01-18 20:09:17 +00:00
|
|
|
compass "--force", "--boring"
|
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
|