duvet 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/test/test_covs.rb ADDED
@@ -0,0 +1,67 @@
1
+ require_relative 'helper'
2
+
3
+ class TestCovs < MiniTest::Unit::TestCase
4
+
5
+ def setup
6
+ @files = {
7
+ 'lib/duvet.rb' => [3, 2, 1, 0, nil],
8
+ 'lib/duvet/cov.rb' => [nil, nil, 0, 1, 2]
9
+ }
10
+ @covs = Duvet::Covs.new(@files)
11
+ end
12
+
13
+ def test_creates_cov_instances
14
+ assert_kind_of Array, @covs
15
+ @covs.each do |i|
16
+ assert_kind_of Duvet::Cov, i
17
+ end
18
+ end
19
+
20
+ def test_creates_report
21
+ report = <<EOS
22
+ lib/duvet.rb
23
+ total: 60.00%
24
+ code: 75.00%
25
+
26
+ lib/duvet/cov.rb
27
+ total: 40.00%
28
+ code: 66.67%
29
+
30
+ EOS
31
+
32
+ assert_equal report, @covs.report
33
+ end
34
+
35
+ def test_has_data_hash
36
+ assert_kind_of Array, @covs.data['files']
37
+ end
38
+
39
+ def test_renders_with_template
40
+ stub.proxy(::Erubis::Eruby).new do |obj|
41
+ stub(obj).result { "yeah" }
42
+ obj
43
+ end
44
+
45
+ assert_equal "yeah", @covs.format
46
+ end
47
+
48
+ def test_writes_files
49
+ dir = Pathname.new("tmp")
50
+
51
+ stub(FileUtils).mkdir_p(dir)
52
+ stub(File).open(dir + 'index.html', 'w')
53
+
54
+ @covs.each {|i| stub(i).write(dir) }
55
+ stub(@covs).write_resources(dir)
56
+
57
+ @covs.write(dir)
58
+ end
59
+
60
+ def test_warns_if_no_files_to_write
61
+ empty_covs = Duvet::Covs.new({})
62
+ assert_output nil, "No files to create coverage for.\n" do
63
+ empty_covs.write(nil)
64
+ end
65
+ end
66
+
67
+ end
@@ -0,0 +1,17 @@
1
+ require_relative 'helper'
2
+
3
+ class TestDuvet < MiniTest::Unit::TestCase
4
+
5
+ def test_has_version
6
+ assert Duvet::VERSION
7
+ end
8
+
9
+ def test_has_defaults
10
+ assert_equal({:dir => 'cov', :style => 'rcov'}, Duvet::DEFAULTS)
11
+ end
12
+
13
+ def test_has_template_path
14
+ assert Duvet::TEMPLATE_PATH.to_s.include?('duvet/templates')
15
+ end
16
+
17
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duvet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: erubis
17
- requirement: &2152736560 !ruby/object:Gem::Requirement
17
+ requirement: &2156903160 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '2.7'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2152736560
25
+ version_requirements: *2156903160
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: sass
28
- requirement: &2152736100 !ruby/object:Gem::Requirement
28
+ requirement: &2156902700 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '3.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2152736100
36
+ version_requirements: *2156902700
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rr
39
- requirement: &2161069860 !ruby/object:Gem::Requirement
39
+ requirement: &2156817000 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: 1.0.2
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *2161069860
47
+ version_requirements: *2156817000
48
48
  description: ! " A simple code coverage tool for Ruby 1.9. Add 'Duvet.start' to
49
49
  the top\n of your test helper, to have it write code coverage stuff to 'cov/'.\n"
50
50
  email: m@hawx.me
@@ -55,6 +55,22 @@ files:
55
55
  - README.md
56
56
  - Rakefile
57
57
  - LICENSE
58
+ - lib/duvet/core_ext.rb
59
+ - lib/duvet/cov.rb
60
+ - lib/duvet/covs.rb
61
+ - lib/duvet/version.rb
62
+ - lib/duvet.rb
63
+ - templates/css/styles.sass
64
+ - templates/html/file.erb
65
+ - templates/html/index.erb
66
+ - templates/js/jquery.js
67
+ - templates/js/main.js
68
+ - templates/js/plugins.js
69
+ - test/helper.rb
70
+ - test/test_core_ext.rb
71
+ - test/test_cov.rb
72
+ - test/test_covs.rb
73
+ - test/test_duvet.rb
58
74
  has_rdoc: true
59
75
  homepage: http://github.com/hawx/duvet
60
76
  licenses: []
@@ -80,4 +96,9 @@ rubygems_version: 1.6.2
80
96
  signing_key:
81
97
  specification_version: 3
82
98
  summary: Duvet is a simple code coverage tool for Ruby 1.9.
83
- test_files: []
99
+ test_files:
100
+ - test/helper.rb
101
+ - test/test_core_ext.rb
102
+ - test/test_cov.rb
103
+ - test/test_covs.rb
104
+ - test/test_duvet.rb