compatriot 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/compatriot/report_template.html.haml +17 -16
- data/lib/compatriot/version.rb +1 -1
- data/spec/unit/report_spec.rb +52 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddaa9975e69289bbc51c641b861f290e9eb57381
|
4
|
+
data.tar.gz: eed6c91114357b4ca936320169b6ab7791763954
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6a47fd9d996315f08e76be9bcc7c283e20877ece0ba2d40dfbd25db7dc71cd74d74f52964e523640cfa4324eeecf3eab7d60a170ca69d68177dcfd3ac55acd9
|
7
|
+
data.tar.gz: de7fbdbd99509053d8c040af5233acb3f0eb69f3d3160e5bc65d18ec4cb6a089d8971b24c9272fb884a3bea3abcb95b9bf0f8a384173150727137cafa52f77d1
|
@@ -27,19 +27,20 @@
|
|
27
27
|
|
28
28
|
%h1 Compatriot Test Report
|
29
29
|
- $tests.each_with_index do |test,i|
|
30
|
-
- test.compatriot_assertion_titles
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
%
|
35
|
-
%
|
36
|
-
%
|
37
|
-
%
|
38
|
-
%
|
39
|
-
|
40
|
-
|
41
|
-
%
|
42
|
-
|
43
|
-
|
44
|
-
%
|
45
|
-
|
30
|
+
- if test.respond_to? :compatriot_assertion_titles
|
31
|
+
- test.compatriot_assertion_titles.each_with_index do |title,j|
|
32
|
+
%label.collapse{ for: "_#{i}.#{j}", class: ("failed" unless test.passed?) }= test.location + ":" + title
|
33
|
+
%input{id: "_#{i}.#{j}", type: "checkbox"}
|
34
|
+
%div
|
35
|
+
%table
|
36
|
+
%tbody
|
37
|
+
%tr
|
38
|
+
%td
|
39
|
+
%label.bold Control
|
40
|
+
%img{src: Compatriot.filepath_for_screenshot('control', Compatriot.filename_for_test(test, title))}
|
41
|
+
%td
|
42
|
+
%label.bold Variable
|
43
|
+
%img{src: Compatriot.filepath_for_screenshot('variable', Compatriot.filename_for_test(test, title))}
|
44
|
+
%td
|
45
|
+
%label.bold Diff
|
46
|
+
%img{src: Compatriot.filepath_for_screenshot('diffs', Compatriot.filename_for_test(test, title))}
|
data/lib/compatriot/version.rb
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe Compatriot::Reporter do
|
4
|
+
REPORT_FILENAME = 'compatriot_report.html'
|
5
|
+
before do
|
6
|
+
FileUtils.rm(REPORT_FILENAME) if File.exists?(REPORT_FILENAME)
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'generates an html file' do
|
10
|
+
test1 = stub_everything('test',
|
11
|
+
name: 'test_1_viewing_a_specific_report',
|
12
|
+
location: 'Some description',
|
13
|
+
compatriot_assertion_titles: [ 'did stuff' ],
|
14
|
+
passed?: true)
|
15
|
+
test2 = stub_everything('test',
|
16
|
+
name: 'test_2_viewing_a_specific_report_with_a_filter',
|
17
|
+
location: 'Another description',
|
18
|
+
compatriot_assertion_titles: [ 'did other stuff' ],
|
19
|
+
passed?: false)
|
20
|
+
tests = [
|
21
|
+
test1, test2
|
22
|
+
]
|
23
|
+
Compatriot::Reporter.new(tests).run
|
24
|
+
|
25
|
+
assert File.exist?(REPORT_FILENAME), "#{REPORT_FILENAME} not found"
|
26
|
+
File.readlines(REPORT_FILENAME).grep(/label class='collapse/).count.must_equal 2
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'generates a report even if there were not any assertions made' do
|
30
|
+
tests = [stub_everything('test',
|
31
|
+
name: 'test_1_viewing_a_specific_report',
|
32
|
+
location: 'Some description',
|
33
|
+
compatriot_assertion_titles: [ ],
|
34
|
+
passed?: true)
|
35
|
+
]
|
36
|
+
Compatriot::Reporter.new(tests).run
|
37
|
+
assert File.exist?(REPORT_FILENAME), "#{REPORT_FILENAME} not found"
|
38
|
+
File.readlines(REPORT_FILENAME).grep(/label class='collapse/).count.must_equal 0
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'handles multiple assertions in one test' do
|
42
|
+
tests = [stub_everything('test',
|
43
|
+
name: 'test_1_viewing_a_specific_report',
|
44
|
+
location: 'Some description',
|
45
|
+
compatriot_assertion_titles: [ 'first assertion', 'second assertion' ],
|
46
|
+
passed?: true)
|
47
|
+
]
|
48
|
+
Compatriot::Reporter.new(tests).run
|
49
|
+
assert File.exist?(REPORT_FILENAME), "#{REPORT_FILENAME} not found"
|
50
|
+
File.readlines(REPORT_FILENAME).grep(/label class='collapse/).count.must_equal 2
|
51
|
+
end
|
52
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: compatriot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carol (Nichols || Goulding)
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-05-
|
12
|
+
date: 2016-05-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -254,6 +254,7 @@ files:
|
|
254
254
|
- spec/unit/compatriot_spec.rb
|
255
255
|
- spec/unit/image_differ/color_differ_spec.rb
|
256
256
|
- spec/unit/image_differ/image_differ_spec.rb
|
257
|
+
- spec/unit/report_spec.rb
|
257
258
|
- spec/unit/runner_spec.rb
|
258
259
|
homepage: https://github.com/carols10cents/compatriot
|
259
260
|
licenses:
|
@@ -292,4 +293,5 @@ test_files:
|
|
292
293
|
- spec/unit/compatriot_spec.rb
|
293
294
|
- spec/unit/image_differ/color_differ_spec.rb
|
294
295
|
- spec/unit/image_differ/image_differ_spec.rb
|
296
|
+
- spec/unit/report_spec.rb
|
295
297
|
- spec/unit/runner_spec.rb
|