Skip to content

Commit

Permalink
Merge pull request #17 from ruby/fix-to-use-custom-test-unit
Browse files Browse the repository at this point in the history
Fix to use logger and test-unit in this repo
  • Loading branch information
sonots authored Mar 18, 2019
2 parents f6c2c09 + d3c2402 commit 106ce55
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 14 deletions.
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

gemspec

gem 'test-unit'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
`--location` option is available as:

```
bundle exec ruby test/logger/test_logger.rb --location 40
ruby test/logger/test_logger.rb --location 40
```

## Contributing
Expand Down
2 changes: 0 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ require "bundler/gem_tasks"
require "rake/testtask"

Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib" << "test/lib"
t.test_files = FileList["test/**/test_*.rb"]
end

Expand Down
5 changes: 5 additions & 0 deletions test/helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ROOT_DIR = File.dirname(__dir__)
$LOAD_PATH.unshift File.join(ROOT_DIR, 'lib') # to use logger in this repo instead of ruby built-in logger
$LOAD_PATH.unshift File.join(ROOT_DIR, 'test', 'lib') # to use custom test-unit in this repo
require 'logger'
require 'test/unit'
3 changes: 1 addition & 2 deletions test/logger/test_logdevice.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# coding: US-ASCII
# frozen_string_literal: false
require 'test/unit'
require 'logger'
require_relative '../helper'
require 'tempfile'
require 'tmpdir'

Expand Down
3 changes: 1 addition & 2 deletions test/logger/test_logger.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# coding: US-ASCII
# frozen_string_literal: false
require 'test/unit'
require 'logger'
require_relative '../helper'
require 'tempfile'

class TestLogger < Test::Unit::TestCase
Expand Down
9 changes: 4 additions & 5 deletions test/logger/test_severity.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# coding: US-ASCII
# frozen_string_literal: false
require 'test/unit'
require 'logger'
require_relative '../helper'

class TestLoggerSeverity < Test::Unit::TestCase
def test_enum
Expand All @@ -13,13 +12,13 @@ def test_enum
end
assert_equal(levels.size, Logger::Severity.constants.size)
end

def test_level_assignment
logger = Logger.new(nil)

Logger::Severity.constants.each do |level|
next if level == :UNKNOWN

logger.send("#{level.downcase}!")
assert(logger.level) == Logger::Severity.const_get(level)
end
Expand Down

0 comments on commit 106ce55

Please sign in to comment.