Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rename to journo
  • Loading branch information
Alexander Kern committed May 28, 2011
1 parent ba9e988 commit cd99185
Show file tree
Hide file tree
Showing 24 changed files with 72 additions and 72 deletions.
24 changes: 12 additions & 12 deletions README.md
@@ -1,29 +1,29 @@
# minitest-reporter - reporters for MiniTest [![StillMaintained Status](http://stillmaintained.com/CapnKernul/minitest-reporter.png)](http://stillmaintained.com/CapnKernul/minitest-reporter) [![Build Status](http://travis-ci.org/CapnKernul/minitest-reporter.png)](http://travis-ci.org/CapnKernul/minitest-reporter) #
# journo - reporters for MiniTest [![StillMaintained Status](http://stillmaintained.com/CapnKernul/journo.png)](http://stillmaintained.com/CapnKernul/journo) [![Build Status](http://travis-ci.org/CapnKernul/journo.png)](http://travis-ci.org/CapnKernul/journo) #

Allows you to extend MiniTest using reporters rather than monkey-patching.

## Installation ##

gem install minitest-reporter
gem install journo

## Usage ##

In your `test_helper.rb` file, add the following lines:

require 'minitest-reporter'
MiniTest::Unit.runner = MiniTest::SuiteRunner.new
MiniTest::Unit.runner.reporters << MiniTest::Reporters::ProgressReporter.new
require 'journo'
MiniTest::Unit.runner = Journo::SuiteRunner.new
MiniTest::Unit.runner.reporters << Journo::Reporters::ProgressReporter.new

Now, just run your tests; the reporter you specified will be used and make your
output look absolutely gorgeous! If you feel the need to write your own
reporter, just subclass `MiniTest::Reporter` and override the methods you'd
reporter, just subclass `Journo::Reporter` and override the methods you'd
like. Take a look at the provided reporters for examples.

The following reporters are provided:

MiniTest::Reporters::DefaultReporter # => Identical to the standard MiniTest reporter
MiniTest::Reporters::SpecReporter # => Turn-like output that reads like a spec
MiniTest::Reporters::ProgressReporter # => Fuubar-like output with a progress bar
Journo::Reporters::DefaultReporter # => Identical to the standard MiniTest reporter
Journo::Reporters::SpecReporter # => Turn-like output that reads like a spec
Journo::Reporters::ProgressReporter # => Fuubar-like output with a progress bar

I really like `ProgressReporter`.

Expand All @@ -37,9 +37,9 @@ I really like `ProgressReporter`.

## Resources ##

* [GitHub Repository](https://github.com/CapnKernul/minitest-reporter)
* [Documentation](http://rubydoc.info/github/CapnKernul/minitest-reporter)
* [GitHub Repository](https://github.com/CapnKernul/journo)
* [Documentation](http://rubydoc.info/github/CapnKernul/journo)

## License ##

Minitest-reporter is licensed under the MIT License. See `LICENSE` for details.
Journo is licensed under the MIT License. See `LICENSE` for details.
10 changes: 5 additions & 5 deletions minitest-reporter.gemspec → journo.gemspec
@@ -1,18 +1,18 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path('../lib', __FILE__)
require 'minitest-reporter/version'
require 'journo/version'

Gem::Specification.new do |s|
s.name = 'minitest-reporter'
s.version = MiniTest::Reporter::VERSION
s.name = 'journo'
s.version = Journo::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ['Alexander Kern']
s.email = ['alex@kernul.com']
s.homepage = 'https://github.com/CapnKernul/minitest-reporter'
s.homepage = 'https://github.com/CapnKernul/journo'
s.summary = %q{Reporters for MiniTest}
s.description = %q{Allows you to extend MiniTest using reporters rather than monkey-patching}

s.rubyforge_project = 'minitest-reporter'
s.rubyforge_project = 'journo'

s.add_dependency 'minitest', '~> 2.0'
s.add_dependency 'ansi'
Expand Down
15 changes: 15 additions & 0 deletions lib/journo.rb
@@ -0,0 +1,15 @@
require 'minitest/unit'

module Journo
require 'journo/version'

autoload :Reporter, 'journo/reporter'
autoload :SuiteRunner, 'journo/suite_runner'
autoload :TestRunner, 'journo/test_runner'

module Reporters
autoload :DefaultReporter, 'journo/reporters/default_reporter'
autoload :SpecReporter, 'journo/reporters/spec_reporter'
autoload :ProgressReporter, 'journo/reporters/progress_reporter'
end
end
4 changes: 3 additions & 1 deletion lib/minitest-reporter/reporter.rb → lib/journo/reporter.rb
@@ -1,5 +1,7 @@
module MiniTest
module Journo
class Reporter
VERSION = '0.1.0'

def runner
MiniTest::Unit.runner
end
Expand Down
@@ -1,13 +1,13 @@
require 'ansi'

module MiniTest
module Journo
module Reporters
# A reporter identical to the standard MiniTest reporter.
#
# Based upon Ryan Davis of Seattle.rb's MiniTest (MIT License).
#
# @see https://github.com/seattlerb/minitest MiniTest
class DefaultReporter < MiniTest::Reporter
class DefaultReporter < Journo::Reporter
def before_suites(suites, type)
puts
puts "# Running #{type}s:"
Expand Down
@@ -1,7 +1,7 @@
require 'ansi'
require 'progressbar'

module MiniTest
module Journo
module Reporters
# Fuubar-like reporter with a progress bar.
#
Expand All @@ -10,7 +10,7 @@ module Reporters
#
# @see https://github.com/jeffkreeftmeijer/fuubar Fuubar
# @see https://gist.github.com/356945 paydro's monkey-patch
class ProgressReporter < MiniTest::Reporter
class ProgressReporter < Journo::Reporter
include ANSI::Code

INFO_PADDING = 2
Expand Down
@@ -1,14 +1,14 @@
require 'ansi'

module MiniTest
module Journo
module Reporters
# Turn-like reporter that reads like a spec.
#
# Based upon TwP's turn (MIT License) and paydro's monkey-patch.
#
# @see https://github.com/TwP/turn turn
# @see https://gist.github.com/356945 paydro's monkey-patch
class SpecReporter < MiniTest::Reporter
class SpecReporter < Journo::Reporter
include ANSI::Code

TEST_PADDING = 2
Expand Down
@@ -1,4 +1,4 @@
module MiniTest
module Journo
# Runner for MiniTest suites.
#
# This is a heavily refactored version of the built-in MiniTest runner. It's
Expand All @@ -8,7 +8,7 @@ module MiniTest
# Based upon Ryan Davis of Seattle.rb's MiniTest (MIT License).
#
# @see https://github.com/seattlerb/minitest MiniTest
class SuiteRunner < Unit
class SuiteRunner < MiniTest::Unit
attr_accessor :suite_start_time, :test_start_time, :reporters

def initialize
Expand Down
@@ -1,4 +1,4 @@
module MiniTest
module Journo
# Runner for individual MiniTest tests.
#
# You *should not* create instances of this class directly. Instances of
Expand Down
3 changes: 3 additions & 0 deletions lib/journo/version.rb
@@ -0,0 +1,3 @@
module Journo
VERSION = '0.2.0'
end
15 changes: 0 additions & 15 deletions lib/minitest-reporter.rb

This file was deleted.

5 changes: 0 additions & 5 deletions lib/minitest-reporter/version.rb

This file was deleted.

@@ -1,9 +1,9 @@
require 'test_helper'

module MiniTestReporterTest
module JournoTest
class ReporterTest < TestCase
def setup
@reporter = MiniTest::Reporter.new
@reporter = Journo::Reporter.new
end

test 'callbacks' do
Expand Down
@@ -1,9 +1,9 @@
require 'test_helper'

module MiniTestReporterTest
module JournoTest
class SuiteRunnerTest < TestCase
def setup
@runner = MiniTest::SuiteRunner.new
@runner = Journo::SuiteRunner.new
@reporter = add_reporter
end

Expand Down Expand Up @@ -86,7 +86,7 @@ def setup
test = :test_pass

@reporter.expects(:before_test).with(suite, test)
@reporter.expects(:pass).with(suite, test, instance_of(MiniTest::TestRunner))
@reporter.expects(:pass).with(suite, test, instance_of(Journo::TestRunner))

@runner._run_test(suite, test)

Expand All @@ -100,7 +100,7 @@ def setup
test = :test_skip

@reporter.expects(:before_test).with(suite, test)
@reporter.expects(:skip).with(suite, test, instance_of(MiniTest::TestRunner))
@reporter.expects(:skip).with(suite, test, instance_of(Journo::TestRunner))

@runner._run_test(suite, test)

Expand All @@ -114,7 +114,7 @@ def setup
test = :test_failure

@reporter.expects(:before_test).with(suite, test)
@reporter.expects(:failure).with(suite, test, instance_of(MiniTest::TestRunner))
@reporter.expects(:failure).with(suite, test, instance_of(Journo::TestRunner))

@runner._run_test(suite, test)

Expand All @@ -128,7 +128,7 @@ def setup
test = :test_error

@reporter.expects(:before_test).with(suite, test)
@reporter.expects(:error).with(suite, test, instance_of(MiniTest::TestRunner))
@reporter.expects(:error).with(suite, test, instance_of(Journo::TestRunner))

@runner._run_test(suite, test)

Expand All @@ -148,7 +148,7 @@ def setup
private

def add_reporter
reporter = MiniTest::Reporter.new
reporter = Journo::Reporter.new
@runner.reporters << reporter
reporter
end
Expand Down
@@ -1,11 +1,11 @@
require 'test_helper'

module MiniTestReporterTest
module JournoTest
class TestRunnerTest < TestCase
def setup
@suite = stub
@test = :test_foo
@runner = MiniTest::TestRunner.new(@suite, @test)
@runner = Journo::TestRunner.new(@suite, @test)
end

test '#suite' do
Expand Down
2 changes: 1 addition & 1 deletion test/support/fixtures/empty_test_fixture.rb
@@ -1,4 +1,4 @@
module MiniTestReporterTest
module JournoTest
module Fixtures
class EmptyTestFixture < TestCaseFixture; end
end
Expand Down
2 changes: 1 addition & 1 deletion test/support/fixtures/error_test_fixture.rb
@@ -1,4 +1,4 @@
module MiniTestReporterTest
module JournoTest
module Fixtures
class ErrorTestFixture < TestCaseFixture
def test_error
Expand Down
2 changes: 1 addition & 1 deletion test/support/fixtures/failure_test_fixture.rb
@@ -1,4 +1,4 @@
module MiniTestReporterTest
module JournoTest
module Fixtures
class FailureTestFixture < TestCaseFixture
def test_failure
Expand Down
2 changes: 1 addition & 1 deletion test/support/fixtures/pass_test_fixture.rb
@@ -1,4 +1,4 @@
module MiniTestReporterTest
module JournoTest
module Fixtures
class PassTestFixture < TestCaseFixture
def test_pass
Expand Down
2 changes: 1 addition & 1 deletion test/support/fixtures/skip_test_fixture.rb
@@ -1,4 +1,4 @@
module MiniTestReporterTest
module JournoTest
module Fixtures
class SkipTestFixture < TestCaseFixture
def test_skip
Expand Down
2 changes: 1 addition & 1 deletion test/support/fixtures/suite_callback_test_fixture.rb
@@ -1,4 +1,4 @@
module MiniTestReporterTest
module JournoTest
module Fixtures
class SuiteCallbackTestFixture < TestCaseFixture
def self.startup; end
Expand Down
2 changes: 1 addition & 1 deletion test/support/fixtures/test_case_fixture.rb
@@ -1,4 +1,4 @@
module MiniTestReporterTest
module JournoTest
module Fixtures
class TestCaseFixture
attr_writer :_assertions
Expand Down
2 changes: 1 addition & 1 deletion test/support/test_case.rb
@@ -1,4 +1,4 @@
module MiniTestReporterTest
module JournoTest
class TestCase < MiniTest::Unit::TestCase
end
end
12 changes: 6 additions & 6 deletions test/test_helper.rb
Expand Up @@ -2,9 +2,9 @@
require 'minitest/autorun'
require 'mocha'
require 'test_declarative'
require 'minitest-reporter'
require 'journo'

module MiniTestReporterTest
module JournoTest
require File.expand_path('../support/test_case', __FILE__)

module Fixtures
Expand All @@ -18,7 +18,7 @@ module Fixtures
end
end

MiniTest::Unit.runner = MiniTest::SuiteRunner.new
MiniTest::Unit.runner = Journo::SuiteRunner.new

# Testing the built-in reporters using automated unit testing would be extremely
# brittle. Consequently, there are no unit tests for them. Instead, uncomment
Expand All @@ -28,6 +28,6 @@ module Fixtures
# Personally, I like the progress reporter. Make sure you don't change that line
# when you commit.
#
# MiniTest::Unit.runner.reporters << MiniTest::Reporters::DefaultReporter.new
# MiniTest::Unit.runner.reporters << MiniTest::Reporters::SpecReporter.new
MiniTest::Unit.runner.reporters << MiniTest::Reporters::ProgressReporter.new
# MiniTest::Unit.runner.reporters << Journo::Reporters::DefaultReporter.new
# MiniTest::Unit.runner.reporters << Journo::Reporters::SpecReporter.new
MiniTest::Unit.runner.reporters << Journo::Reporters::ProgressReporter.new

0 comments on commit cd99185

Please sign in to comment.