Sha256: 8399c4fa3c4d073f626da18855c882520a9325c0cfb19051ce422820de5cb47c

Contents?: true

Size: 1.06 KB

Versions: 9

Compression:

Stored size: 1.06 KB

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 '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

9 entries across 9 versions & 3 rubygems

Version Path
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/sass-rails-4.0.5/test/sass_rails_logger_test.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/sass-rails-4.0.5/test/sass_rails_logger_test.rb
sass-rails-4.0.5 test/sass_rails_logger_test.rb
sass-rails-4.0.4 test/sass_rails_logger_test.rb
sass-rails-4.0.3 test/sass_rails_logger_test.rb
sass-rails-4.0.2 test/sass_rails_logger_test.rb
sass-rails-4.0.1 test/sass_rails_logger_test.rb
sass-rails-4.0.0 test/sass_rails_logger_test.rb
sass-rails-4.0.0.rc2 test/sass_rails_logger_test.rb