cukeregator 0.1.0 → 0.1.1

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.
data/Rakefile CHANGED
@@ -39,7 +39,7 @@ namespace :cukeregator do
39
39
 
40
40
  spec = Gem::Specification.new do |s|
41
41
  s.name = 'cukeregator'
42
- s.version = '0.1.0'
42
+ s.version = '0.1.1'
43
43
  s.rubyforge_project = s.name
44
44
 
45
45
  s.platform = Gem::Platform::RUBY
@@ -12,13 +12,7 @@ module Cukeregator
12
12
  @doc.to_html
13
13
  end
14
14
 
15
- def new_doc
16
- doc =Nokogiri::XML::Document.new
17
- root = Nokogiri::XML::Node.new('html', doc)
18
- root.create_internal_subset( 'html', "-//W3C//DTD XHTML 1.0 Strict//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd")
19
- doc << root
20
- doc
21
- end
15
+ private
22
16
 
23
17
  def head
24
18
  h = new_node(:head)
@@ -31,59 +25,37 @@ module Cukeregator
31
25
 
32
26
  def body
33
27
  b = new_node(:body)
34
- b << summary
28
+ b << summary(@aggregator, :id => :summary, :class => @aggregator.status)
29
+ b << new_node(:hr)
35
30
  b << cucumbers
36
31
  b
37
32
  end
38
33
 
39
- def summary
40
- s = new_node(:div, @aggregator.status)
41
- s['id'] = "summary"
42
- s << summary_p(@aggregator, 'totals')
43
- s << summary_p(@aggregator, 'duration')
44
- s
45
- end
46
-
47
34
  def cucumbers
48
- c = new_node(:table)
49
- c['id'] = "cucumbers"
50
- tb = new_node(:tbody)
35
+ c = new_node(:div, :id => :cucumbers )
51
36
  @aggregator.docs.each do |doc_data|
52
- tb << row(doc_data)
37
+ c << summary(doc_data, :class => "#{doc_data.status} cucumber result_summary") << link_for(doc_data.path, :class => :result_detail)
53
38
  end
54
- c << tb
55
39
  c
56
40
  end
57
41
 
58
- def row(doc_data)
59
- tr = new_node(:tr, doc_data.status)
60
- td = new_node(:td, 'result-detail')
61
- td << link_for(doc_data.path)
62
- tr << td
63
-
64
- td = new_node(:td, 'result-summary')
65
- td << summary_p(doc_data, 'totals')
66
- td << summary_p(doc_data, 'duration')
67
- tr << td
68
- tr
69
- end
70
-
71
- def link_for(path)
72
- a = new_node(:a)
42
+ def link_for(path, attributes = {})
43
+ a = new_node(:a, attributes)
73
44
  a['href'] = path
74
- a.content = path
45
+ a.content = path.split(File::SEPARATOR).last
75
46
  a
76
47
  end
77
48
 
78
- def new_node(name, class_name = nil)
79
- n = Nokogiri::XML::Node.new(name.to_s, @doc)
80
- n['class'] = class_name.to_s if class_name
81
- n
49
+ def summary(data, attributes)
50
+ s = new_node(:div, attributes)
51
+ s << summary_p(data, 'totals')
52
+ s << summary_p(data, 'duration')
53
+ s
82
54
  end
83
55
 
84
- def summary_p(o, which)
56
+ def summary_p(data, which)
85
57
  p = new_node(:p, which)
86
- p.inner_html = o.send("#{which}_inner_html")
58
+ p.inner_html = data.send("#{which}_inner_html")
87
59
  p
88
60
  end
89
61
 
@@ -93,5 +65,21 @@ module Cukeregator
93
65
  style.content = "\n#{File.read(File.expand_path(File.dirname(__FILE__)) + '/style.css')}"
94
66
  style
95
67
  end
68
+
69
+ def new_doc
70
+ doc =Nokogiri::XML::Document.new
71
+ root = Nokogiri::XML::Node.new('html', doc)
72
+ root.create_internal_subset( 'html', "-//W3C//DTD XHTML 1.0 Strict//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd")
73
+ doc << root
74
+ doc
75
+ end
76
+
77
+ def new_node(name, attributes = {})
78
+ n = Nokogiri::XML::Node.new(name.to_s, @doc)
79
+ attributes.each do | attr, value |
80
+ n[attr.to_s] = value.to_s
81
+ end
82
+ n
83
+ end
96
84
  end
97
85
  end
@@ -64,7 +64,7 @@ module Cukeregator
64
64
  end
65
65
 
66
66
  # our data lies in javascript functions at the bottom of the body, because
67
- # Aslak can't put up the totals until the suite completes
67
+ # Cucumber can't put up the totals until the suite completes
68
68
  def parse_scripts(doc)
69
69
  doc.search("body script").map {|script| script.text }
70
70
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cukeregator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tim Camper
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-27 00:00:00 -04:00
18
+ date: 2011-03-29 00:00:00 -04:00
19
19
  default_executable: cukeregator
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency