Sha256: 8459b57ac66850c9ff7ce5a1bf17768a222db5ea55bcd662a93c55789027282d

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require 'test_helper'

class SassRails3LoggerTest < Sass::Rails::TestCase
  test "setting a sass-rails3 logger as the sass default logger" do
    within_rails_app "scss_project" do
      logger_class_name = runcmd 'ruby script/rails runner "print Sass::logger.class.name"'
      assert logger_class_name =~ /#{Regexp.escape(Sass::Rails::Logger.name)}/
    end
  end

  test "sending a log messages to the sass logger writes to the environment log file" do
    within_rails_app "scss_project" do |app_root|
      [:debug, :warn, :info, :error, :trace].each do |level|
        message = "[#{level}]: sass message"
        runcmd %{ruby script/rails runner "Sass::logger.log_level = :#{level}; Sass::logger.log(:#{level}, %Q|#{message}|)"}, Dir.pwd, true, 'Gemfile', { 'RAILS_ENV' => 'development' }

        assert File.exists?("#{app_root}/log/development.log"), "log file was not created"

        log_output = File.open("#{app_root}/log/development.log").read
        assert log_output.include?(message), "the #{level} log message was not found in the log file"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sass-rails3-4.0.1 test/sass_rails_logger_test.rb