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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 52335a1370e7cf3da50555a02c667e6dc8389b33
4
- data.tar.gz: da7bef0b5be93ebb60ddf4a4f7f22236190c2561
3
+ metadata.gz: ddaa9975e69289bbc51c641b861f290e9eb57381
4
+ data.tar.gz: eed6c91114357b4ca936320169b6ab7791763954
5
5
  SHA512:
6
- metadata.gz: b11a74741daac8e3e2589ea78a54a72c7e7045cb9cb47bae5f9050d029ffaf3d263f09e180572b7eacc4bf8303fdc6744de42931cc312b2e852fe43d51486445
7
- data.tar.gz: 8476a55fda6ed11afc4be69a994254f67b37c5ca685389d06971159819fc01ff235157f7939fc91acf29736ac121149934065fa49448d8990ee44a9a6855921b
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.each_with_index do |title,j|
31
- %label.collapse{ for: "_#{i}.#{j}", class: ("failed" unless test.passed?) }= test.location + ":" + title
32
- %input{id: "_#{i}.#{j}", type: "checkbox"}
33
- %div
34
- %table
35
- %tbody
36
- %tr
37
- %td
38
- %label.bold Control
39
- %img{src: Compatriot.filepath_for_screenshot('control', Compatriot.filename_for_test(test, title))}
40
- %td
41
- %label.bold Variable
42
- %img{src: Compatriot.filepath_for_screenshot('variable', Compatriot.filename_for_test(test, title))}
43
- %td
44
- %label.bold Diff
45
- %img{src: Compatriot.filepath_for_screenshot('diffs', Compatriot.filename_for_test(test, title))}
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))}
@@ -1,3 +1,3 @@
1
1
  module Compatriot
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -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.3
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-03 00:00:00.000000000 Z
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