gamifying_formatter 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 308f6e820cd5c35d1f0e1cb880c9d9c9947d9a34
4
- data.tar.gz: 9149b823cba62dea23420ab53a8b10a8114f9de9
3
+ metadata.gz: e87c0fec299d4ea61f356be791062daa081d9b7d
4
+ data.tar.gz: 03fb699bc04e0ead342ed2ae38435edbaaf70346
5
5
  SHA512:
6
- metadata.gz: 8d73b00ff3ed98a0fe1ed512be8f5ea794ed19035157e0964de5ae89b6b85e2b6db074546adf09fa384062003ee0779b78a07e7e0acead924cdc579864188570
7
- data.tar.gz: eda62592b01de6398116e154f84f8ba14b526c20025a20187cd8f36fccf6b31d116ac972af4a397f98e476f33905a4a55debc431064687e9e3bde25e2913468f
6
+ metadata.gz: b7d4bb33cd802a1a053cc333a3f22464536ff5dafccff7137bc362d9cf6cb956fabb295cffe7245451a6c6f717ce9ef1dbf98e4ab548dd4cf42401152d7455b3
7
+ data.tar.gz: ff7560518389a813359b3be8b28333484411615036c193454141d6073175a818f382ed09abadeaafd9d1da161073726d03fe8ec3d3940ead5558a28026431d1c
data/README.md CHANGED
@@ -10,7 +10,7 @@ Adding tests
10
10
 
11
11
  You receive the trophies based on the amount of points you get which start out small and get bigger.
12
12
 
13
- Now works on Rspec 1/2/3.
13
+ Now works on Rspec 1/2/3 and Minitest 5.
14
14
 
15
15
  Thanks goes to the good folks at [nyan-cat-formatter](https://github.com/mattsears/nyan-cat-formatter) for the inspiration to do this and blazing for the trail for creating formatters.
16
16
 
@@ -34,10 +34,16 @@ If you want to use the Gamifying Formatter as your default formatter just put th
34
34
 
35
35
  ## Usage
36
36
 
37
+ ### Rspec
38
+
37
39
  To use the GamifyingFormatter all you need to do is add this option when you are running your spect tests if you did not already edit your .rspec file:
38
40
 
39
41
  --format GamifyingFormatter
40
42
 
43
+ ### Minitest
44
+
45
+ To use the GameifyingFormatter with Minitest, simply install it via `gem` or `bundle` and you should be all set to go.
46
+
41
47
  ## Example
42
48
 
43
49
  Run the example using:
@@ -3,17 +3,18 @@ lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
- gem.name = "gamifying_formatter"
7
- gem.version = '1.0.0'
6
+ gem.name = 'gamifying_formatter'
7
+ gem.version = '1.1.0'
8
8
  gem.authors = ["Chris Belsole"]
9
9
  gem.email = ["cbelsole@gmail.com"]
10
10
  gem.description = %q{The Gamifying Formatter}
11
11
  gem.summary = %q{An rspec formatter for making testing fun.}
12
- gem.homepage = ""
13
-
12
+ gem.homepage = 'https://github.com/cbelsole/GamifyingFormatter'
13
+ gem.licenses = ['MIT']
14
14
  gem.files = `git ls-files`.split($/)
15
15
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
16
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
17
  gem.require_paths = ["lib"]
18
18
  gem.add_dependency 'rspec', '= 3.0.0'
19
+ gem.add_dependency 'minitest', '~> 5.0'
19
20
  end
@@ -11,13 +11,6 @@ class RSpec3 < RSpec::Core::Formatters::BaseTextFormatter
11
11
  @test_info = load_test_info
12
12
  end
13
13
 
14
- def wrap_up(num_of_examples, num_of_failed_examples, duration)
15
- @test_info.number_of_tests = num_of_examples
16
- @test_info.number_of_failed_tests = num_of_failed_examples
17
- @test_info.total_time = duration
18
- File.open('.past_results.yml', 'w') { |file| file.puts @test_info.to_yaml }
19
- end
20
-
21
14
  def dump_summary(summary_notification)
22
15
  super(summary_notification)
23
16
 
@@ -0,0 +1,26 @@
1
+ require 'gamifying_formatter/common'
2
+
3
+ module Minitest
4
+ class GamifyingReporter < StatisticsReporter
5
+ include GamifyingFormatters::Common
6
+
7
+ def initialize
8
+ super
9
+ @test_info = load_test_info
10
+ end
11
+
12
+ def report
13
+ super
14
+
15
+ num_of_failures = failures + errors
16
+ total = count - skips
17
+ achievements = calculate_achevements(total, num_of_failures, total_time)
18
+ show_achievements unless achievements.empty?
19
+ show_xp_bar
20
+ wrap_up(total, num_of_failures, total_time)
21
+ end
22
+
23
+ alias_method :output, :io
24
+
25
+ end
26
+ end
@@ -0,0 +1,7 @@
1
+ require_relative 'gamifying_reporter'
2
+
3
+ module Minitest
4
+ def self.plugin_gamifying_reporter_init(options)
5
+ self.reporter.reporters.push Minitest::GamifyingReporter.new
6
+ end
7
+ end
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Minitest::GamifyingReporter' do
4
+
5
+ before do
6
+ File.delete(results_path) if File.exists?(results_path)
7
+ end
8
+
9
+ let(:results_path) { File.join(File.expand_path('..', __FILE__), '.past_results.yml') }
10
+
11
+ let(:output) {
12
+ Dir.chdir(File.dirname(__FILE__)) do
13
+ `BUNDLE_GEMFILE=../../Gemfile bundle exec ruby test_example.rb`
14
+ end
15
+ }
16
+
17
+ it 'shows achievements' do
18
+ expect(output).to include(
19
+ <<-EOS
20
+ !!!!!!!!Achievements!!!!!!!!
21
+ .__.
22
+ (| |)
23
+ ( )
24
+ _)(_
25
+ --------------------
26
+ | Added 1 test(s)! |
27
+ --------------------
28
+ EOS
29
+ )
30
+ end
31
+
32
+ it 'shows xp bar' do
33
+ expect(output).to include(
34
+ <<-EOS
35
+ Level 1: 1/10 [== ]
36
+ EOS
37
+ )
38
+ end
39
+
40
+ it 'writes results' do
41
+ output
42
+ expect(File.exists?(results_path)).to be_truthy
43
+ end
44
+ end
@@ -0,0 +1,7 @@
1
+ require 'minitest/autorun'
2
+
3
+ class TestExample < Minitest::Test
4
+ def test_truth
5
+ assert true
6
+ end
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gamifying_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Belsole
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-24 00:00:00.000000000 Z
11
+ date: 2016-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
27
41
  description: The Gamifying Formatter
28
42
  email:
29
43
  - cbelsole@gmail.com
@@ -44,12 +58,17 @@ files:
44
58
  - lib/gamifying_formatter/rspec1.rb
45
59
  - lib/gamifying_formatter/rspec2.rb
46
60
  - lib/gamifying_formatter/rspec3.rb
61
+ - lib/minitest/gamifying_reporter.rb
62
+ - lib/minitest/gamifying_reporter_plugin.rb
47
63
  - lib/test_info.rb
48
64
  - spec/gamifying_formatter/gamifying_formatter_spec.rb
65
+ - spec/minitest/gamifying_reporter_spec.rb
66
+ - spec/minitest/test_example.rb
49
67
  - spec/spec_helper.rb
50
68
  - spec/test_info_spec.rb
51
- homepage: ''
52
- licenses: []
69
+ homepage: https://github.com/cbelsole/GamifyingFormatter
70
+ licenses:
71
+ - MIT
53
72
  metadata: {}
54
73
  post_install_message:
55
74
  rdoc_options: []
@@ -67,12 +86,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
86
  version: '0'
68
87
  requirements: []
69
88
  rubyforge_project:
70
- rubygems_version: 2.4.1
89
+ rubygems_version: 2.2.2
71
90
  signing_key:
72
91
  specification_version: 4
73
92
  summary: An rspec formatter for making testing fun.
74
93
  test_files:
75
94
  - spec/gamifying_formatter/gamifying_formatter_spec.rb
95
+ - spec/minitest/gamifying_reporter_spec.rb
96
+ - spec/minitest/test_example.rb
76
97
  - spec/spec_helper.rb
77
98
  - spec/test_info_spec.rb
78
99
  has_rdoc: