minitest-hyper 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/Rakefile +7 -2
- data/assets/sample_report.png +0 -0
- data/lib/minitest/hyper/report.rb +19 -11
- data/lib/minitest/hyper/reporter.rb +0 -4
- data/lib/minitest/hyper_plugin.rb +19 -9
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09cc6208190579cf460ad97d83d1b92e49e39b37
|
4
|
+
data.tar.gz: 3994b587bfa8e682875e01640c2494a5991dff66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6206ea2d5a523163e8dff56bc527ca858982cda7b0db4fc4fa9278b234475d66ef91a26b5f60085ae8ee736988ca21fda349e45eb7926e38aacf74b622115ac2
|
7
|
+
data.tar.gz: eb4b4e28f794acd770e1ac55622c65d37dde6c70f936e7f6c07d1c5e421b0417cd838a0e1176b6260daa5a7542741f1b763c2ac58e9b7257ed3df73538f72a8f
|
data/README.md
CHANGED
@@ -4,6 +4,8 @@ Generates attractive, self-contained HTML reports for your Minitest runs.
|
|
4
4
|
|
5
5
|
This gem was created as a demonstration of how to build a Minitest extension for [The Minitest Cookbook](http://chriskottom.com/minitestcookbook/).
|
6
6
|
|
7
|
+
![Sample Report](./assets/sample_report.png)
|
8
|
+
|
7
9
|
## Installation
|
8
10
|
|
9
11
|
Add this line to your application's Gemfile:
|
@@ -43,6 +45,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
43
45
|
|
44
46
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/minitest-hyper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
45
47
|
|
48
|
+
[The issue tracker for this project](https://github.com/[USERNAME]/minitest-hyper/issues) is the master list of enhancements and defects in need of repair. If you're looking to contribute, start there.
|
49
|
+
|
46
50
|
## License
|
47
51
|
|
48
52
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
@@ -4,7 +4,12 @@ require "rake/testtask"
|
|
4
4
|
Rake::TestTask.new(:test) do |t|
|
5
5
|
t.libs << "test"
|
6
6
|
t.libs << "lib"
|
7
|
-
t.test_files = FileList['test/**/*_test.rb']
|
7
|
+
t.test_files = FileList['test/minitest/**/*_test.rb']
|
8
8
|
end
|
9
|
-
|
10
9
|
task :default => :test
|
10
|
+
|
11
|
+
Rake::TestTask.new("test:integration") do |t|
|
12
|
+
t.libs << "test"
|
13
|
+
t.libs << "lib"
|
14
|
+
t.test_files = FileList['test/integration/**/*_test.rb']
|
15
|
+
end
|
Binary file
|
@@ -10,30 +10,38 @@ module Minitest
|
|
10
10
|
@reporter = reporter
|
11
11
|
end
|
12
12
|
|
13
|
-
def url
|
14
|
-
"file://#{ REPORT_FILE.gsub(/\\/, "/") }"
|
15
|
-
end
|
16
|
-
|
17
13
|
def write
|
18
14
|
ensure_output_dir
|
19
15
|
move_existing_file
|
20
16
|
write_file
|
21
17
|
end
|
22
18
|
|
19
|
+
def url
|
20
|
+
"file://#{ filename.gsub(/\\/, "/") }"
|
21
|
+
end
|
22
|
+
|
23
|
+
def dirname
|
24
|
+
Minitest::Hyper.report_dirname
|
25
|
+
end
|
26
|
+
|
27
|
+
def filename
|
28
|
+
Minitest::Hyper.report_filename
|
29
|
+
end
|
30
|
+
|
23
31
|
private
|
24
32
|
|
25
33
|
def ensure_output_dir
|
26
|
-
unless Dir.exist?(
|
27
|
-
FileUtils.mkdir_p
|
34
|
+
unless Dir.exist?(dirname)
|
35
|
+
FileUtils.mkdir_p dirname
|
28
36
|
end
|
29
37
|
end
|
30
38
|
|
31
39
|
def move_existing_file
|
32
|
-
if File.exist?(
|
33
|
-
ctime = File.ctime(
|
40
|
+
if File.exist?(filename)
|
41
|
+
ctime = File.ctime(filename)
|
34
42
|
time_str = ctime.strftime("%Y%m%d%H%M%S")
|
35
|
-
new_name =
|
36
|
-
FileUtils.mv(
|
43
|
+
new_name = filename.sub(/\.html$/, "_#{ time_str }.html")
|
44
|
+
FileUtils.mv(filename, new_name)
|
37
45
|
end
|
38
46
|
end
|
39
47
|
|
@@ -46,7 +54,7 @@ module Minitest
|
|
46
54
|
test_info = reporter.to_h
|
47
55
|
|
48
56
|
erb = ERB.new(template_string)
|
49
|
-
File.open(
|
57
|
+
File.open(filename, "wb") do |file|
|
50
58
|
file.write erb.result(binding)
|
51
59
|
end
|
52
60
|
end
|
@@ -23,19 +23,15 @@ module Minitest
|
|
23
23
|
|
24
24
|
module Hyper
|
25
25
|
GEM_DIR = File.join(File.dirname(__FILE__), "../..")
|
26
|
-
WORKING_DIR = Dir.pwd
|
27
|
-
|
28
|
-
REPORTS_DIR = File.join(WORKING_DIR, "test/reports/hyper")
|
29
|
-
REPORT_FILE = File.join(REPORTS_DIR, "index.html")
|
30
26
|
|
31
27
|
TEMPLATE_DIR = File.join(GEM_DIR, "lib/templates")
|
32
28
|
CSS_TEMPLATE = File.join(TEMPLATE_DIR, "hyper.css")
|
33
29
|
HTML_TEMPLATE = File.join(TEMPLATE_DIR, "index.html.erb")
|
34
|
-
|
35
|
-
VERSION = "0.
|
30
|
+
|
31
|
+
VERSION = "0.2.0"
|
36
32
|
|
37
33
|
@@enabled = false
|
38
|
-
|
34
|
+
|
39
35
|
def self.enabled?
|
40
36
|
@@enabled
|
41
37
|
end
|
@@ -44,8 +40,22 @@ module Minitest
|
|
44
40
|
@@enabled = true
|
45
41
|
end
|
46
42
|
|
47
|
-
def
|
48
|
-
|
43
|
+
def self.report_dirname
|
44
|
+
project_root = if defined?(Rails) && defined?(Rails.root)
|
45
|
+
Rails.root
|
46
|
+
else
|
47
|
+
Dir.pwd
|
48
|
+
end
|
49
|
+
|
50
|
+
if Dir.exist?(File.join(project_root, "spec"))
|
51
|
+
File.join(project_root, "spec/reports/hyper")
|
52
|
+
else
|
53
|
+
File.join(project_root, "test/reports/hyper")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.report_filename
|
58
|
+
File.join(report_dirname, "index.html")
|
49
59
|
end
|
50
60
|
end
|
51
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-hyper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Kottom
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- LICENSE.txt
|
67
67
|
- README.md
|
68
68
|
- Rakefile
|
69
|
+
- assets/sample_report.png
|
69
70
|
- bin/console
|
70
71
|
- bin/setup
|
71
72
|
- lib/minitest/hyper.rb
|