Sha256: 6fd29863ab22e7d5821b19adadf769e827e8f0e9afcbed49269273d7222936d3

Contents?: true

Size: 1.06 KB

Versions: 23

Compression:

Stored size: 1.06 KB

Contents

require 'test_helper'

class SamuelTest < Test::Unit::TestCase

  context "logger configuration" do
    setup do
      Samuel.logger = nil
      if Object.const_defined?(:RAILS_DEFAULT_LOGGER)
        Object.send(:remove_const, :RAILS_DEFAULT_LOGGER)
      end
    end

    teardown do
      Samuel.logger = nil
    end

    context "when Rails's logger is available" do
      setup { Object.const_set(:RAILS_DEFAULT_LOGGER, :mock_logger) }

      should "use the same logger" do
        assert_equal :mock_logger, Samuel.logger
      end
    end

    context "when Rails's logger is not available" do
      should "use a new Logger instance pointed to STDOUT" do
        assert_instance_of Logger, Samuel.logger
        assert_equal STDOUT, Samuel.logger.instance_variable_get(:"@logdev").dev
      end
    end
  end


  context ".reset_config" do
    should "reset the config to default vaules" do
      Samuel.config = {:foo => "bar"}
      Samuel.reset_config
      assert_equal({:label => nil, :labels => {"" => "HTTP"}, :filtered_params => []}, Samuel.config)
    end
  end

end

Version data entries

23 entries across 23 versions & 8 rubygems

Version Path
chrisk-samuel-0.2.1 test/samuel_test.rb
messagebus_ruby_api-0.4.7 spec/ruby/1.9.1/gems/fakeweb-1.3.0/test/vendor/samuel-0.2.1/test/samuel_test.rb
messagebus_ruby_api-0.4.4 spec/ruby/1.9.1/gems/fakeweb-1.3.0/test/vendor/samuel-0.2.1/test/samuel_test.rb
putio-0.0.1.pre2 development/ruby/1.8/gems/fakeweb-1.3.0/test/vendor/samuel-0.2.1/test/samuel_test.rb
putio-0.0.1.pre development/ruby/1.8/gems/fakeweb-1.3.0/test/vendor/samuel-0.2.1/test/samuel_test.rb
cotweet-fakeweb-1.3.0 test/vendor/samuel-0.2.1/test/samuel_test.rb
fakeweb-1.3.0 test/vendor/samuel-0.2.1/test/samuel_test.rb
corntrace-fakeweb-1.2.9 test/vendor/samuel-0.2.1/test/samuel_test.rb
webmock-1.0.0 spec/vendor/samuel-0.2.1/test/samuel_test.rb
webmock-0.9.1 spec/vendor/samuel-0.2.1/test/samuel_test.rb
webmock-0.9.0 spec/vendor/samuel-0.2.1/test/samuel_test.rb
webmock-0.8.2 spec/vendor/samuel-0.2.1/test/samuel_test.rb
webmock-0.8.1 spec/vendor/samuel-0.2.1/test/samuel_test.rb
samuel-0.3.1 test/samuel_test.rb
samuel-0.3.0 test/samuel_test.rb
fakeweb-1.2.8 test/vendor/samuel-0.2.1/test/samuel_test.rb
webmock-0.8.0 spec/vendor/samuel-0.2.1/test/samuel_test.rb
webmock-0.7.3 spec/vendor/samuel-0.2.1/test/samuel_test.rb
webmock-0.7.2 spec/vendor/samuel-0.2.1/test/samuel_test.rb
webmock-0.7.1 spec/vendor/samuel-0.2.1/test/samuel_test.rb