2009-11-19 10:26:35 +00:00
|
|
|
require 'test_helper'
|
2009-06-12 18:00:04 +00:00
|
|
|
require 'fileutils'
|
|
|
|
require 'compass'
|
|
|
|
require 'compass/exec'
|
|
|
|
require 'timeout'
|
|
|
|
|
|
|
|
class RailsIntegrationTest < Test::Unit::TestCase
|
|
|
|
include Compass::CommandLineHelper
|
2009-08-25 21:18:58 +00:00
|
|
|
include Compass::IoHelper
|
2009-10-26 03:15:31 +00:00
|
|
|
include Compass::RailsHelper
|
2009-06-12 18:00:04 +00:00
|
|
|
|
|
|
|
def setup
|
2009-08-25 21:18:58 +00:00
|
|
|
Compass.reset_configuration!
|
2009-06-12 18:00:04 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_rails_install
|
2010-05-31 20:12:05 +00:00
|
|
|
within_tmp_directory do
|
2010-01-18 20:09:17 +00:00
|
|
|
begin
|
2009-06-20 17:33:47 +00:00
|
|
|
generate_rails_app_directories("compass_rails")
|
2009-06-12 18:00:04 +00:00
|
|
|
Dir.chdir "compass_rails" do
|
2010-12-19 01:13:47 +00:00
|
|
|
compass(*%w(init rails --trace --boring .)) do |responder|
|
|
|
|
responder.respond_to %r{^\s*Is this OK\? \(Y/n\)\s*$}, :with => "Y"
|
|
|
|
responder.respond_to %r{^\s*Emit compiled stylesheets to public/stylesheets/compiled/\? \(Y/n\)\s*$}, :with => "Y"
|
2009-06-12 18:00:04 +00:00
|
|
|
end
|
|
|
|
# puts ">>>#{@last_result}<<<"
|
2010-04-12 04:10:27 +00:00
|
|
|
assert_action_performed :create, "./app/stylesheets/screen.scss"
|
2009-06-12 18:00:04 +00:00
|
|
|
assert_action_performed :create, "./config/initializers/compass.rb"
|
|
|
|
end
|
2010-01-18 20:09:17 +00:00
|
|
|
ensure
|
|
|
|
FileUtils.rm_rf "compass_rails"
|
2009-06-12 18:00:04 +00:00
|
|
|
end
|
2010-05-31 20:12:05 +00:00
|
|
|
end
|
2009-06-12 18:00:04 +00:00
|
|
|
rescue LoadError
|
|
|
|
puts "Skipping rails test. Couldn't Load rails"
|
|
|
|
end
|
|
|
|
|
2009-06-20 17:33:47 +00:00
|
|
|
def test_rails_install_with_no_dialog
|
|
|
|
within_tmp_directory do
|
|
|
|
generate_rails_app_directories("compass_rails")
|
|
|
|
Dir.chdir "compass_rails" do
|
2010-12-10 17:34:36 +00:00
|
|
|
compass(*%w(init rails --trace --boring --sass-dir app/stylesheets --css-dir public/stylesheets/compiled .))
|
2010-04-12 04:10:27 +00:00
|
|
|
assert_action_performed :create, "./app/stylesheets/screen.scss"
|
2009-06-20 17:33:47 +00:00
|
|
|
assert_action_performed :create, "./config/initializers/compass.rb"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
rescue LoadError
|
|
|
|
puts "Skipping rails test. Couldn't Load rails"
|
|
|
|
end
|
2009-10-26 03:15:31 +00:00
|
|
|
end
|