Sha256: f10aa4a466f7bcc611367cd11854692938df681e08c99f9ad04f8975529705eb

Contents?: true

Size: 1.05 KB

Versions: 42

Compression:

Stored size: 1.05 KB

Contents

require 'test_helper'
require 'singleton'

module Wovnrb
  class StoreTest < WovnMiniTest
    def setup
      Singleton.__init__(WovnLogger)
    end

    def test_initialize
      log_file_name = 'test_tmp.log'
      Store.instance.settings({'log_path' => log_file_name})
      WovnLogger.instance
      assert(File.exists?(log_file_name))
      File.delete(log_file_name)
    end

    def test_initialize_without_path
      path = Store.instance.settings['log_path']
      Store.instance.settings({'log_path' => nil})
      WovnLogger.instance
      assert_equal(false, File.exists?(path))
    end

    def test_initialize_wit_invalid_path
      log_file_name = 'in/val/id/test_tmp.log'
      Store.instance.settings({'log_path' => log_file_name})
      WovnLogger.instance
      assert_equal(false, File.exists?(log_file_name))
      assert_equal(true, File.exists?('wovn_error.log'))
      File.delete('wovn_error.log')
    end

    def test_error
      mock = LogMock.mock_log
      WovnLogger.instance.error('aaa')
      assert_equal(['aaa'], mock.errors)
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
wovnrb-1.0.12 test/lib/services/wovn_logger_test.rb
wovnrb-1.0.11 test/lib/services/wovn_logger_test.rb
wovnrb-1.0.10 test/lib/services/wovn_logger_test.rb
wovnrb-1.0.9 test/lib/services/wovn_logger_test.rb
wovnrb-1.0.8 test/lib/services/wovn_logger_test.rb
wovnrb-1.0.7 test/lib/services/wovn_logger_test.rb
wovnrb-1.0.6 test/lib/services/wovn_logger_test.rb
wovnrb-1.0.5 test/lib/services/wovn_logger_test.rb
wovnrb-1.0.4 test/lib/services/wovn_logger_test.rb
wovnrb-1.0.2 test/lib/services/wovn_logger_test.rb
wovnrb-1.0.1 test/lib/services/wovn_logger_test.rb
wovnrb-1.0.0 test/lib/services/wovn_logger_test.rb
wovnrb-0.2.30 test/lib/services/wovn_logger_test.rb
wovnrb-0.2.29 test/lib/services/wovn_logger_test.rb
wovnrb-0.2.28 test/lib/services/wovn_logger_test.rb
wovnrb-0.2.27 test/lib/services/wovn_logger_test.rb
wovnrb-0.2.26 test/lib/services/wovn_logger_test.rb
wovnrb-0.2.25 test/lib/services/wovn_logger_test.rb
wovnrb-0.2.24 test/lib/services/wovn_logger_test.rb
wovnrb-0.2.23 test/lib/services/wovn_logger_test.rb