Sha256: 986bec6a0177b38ddfe3a2a531de4545ce5b6bf13369fe9bec53e061128ebae1

Contents?: true

Size: 949 Bytes

Versions: 2

Compression:

Stored size: 949 Bytes

Contents

require 'test_helper'

class SassRailsLoggerTest < Sass::Rails::TestCase
  test "setting a sass-rails logger as the sass default logger" do
    within_rails_app "scss_project" do
      logger_class_name = runcmd 'rails runner "print Sass::logger.class.name"'
      assert_equal Sass::Rails::Logger.name, logger_class_name
    end
  end

  [:debug, :warn, :info, :error, :trace].each do |level|
    test "sending a #{level} message to the sass logger writes to the environment log file" do
      within_rails_app "scss_project" do
        app_root = runcmd 'rails runner "print Rails.root"'

        message = "[#{level}]: sass message"
        runcmd %{rails runner "Sass::logger.log_level = :#{level}; Sass::logger.log(:#{level}, '#{message}')"}

        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

2 entries across 2 versions & 1 rubygems

Version Path
sass-rails-3.1.0.rc.4 test/sass_rails_logger_test.rb
sass-rails-3.1.0.rc.3 test/sass_rails_logger_test.rb