rspec-formatter-webkit 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f53123d76b7e48e5111831b201e788fe23b87bb
4
- data.tar.gz: 9a9bc34d45b4e8269d95869dd2ab3f7682b69986
3
+ metadata.gz: 7bef1df9eca5adfdaf5b8ad30caac871013580b9
4
+ data.tar.gz: 224c3eb4219434fd952c94a2933e501a8647a580
5
5
  SHA512:
6
- metadata.gz: 827448bfcd12fd99a4389d4fef2f17d5d94004812a82ae0ceef069e82e8fbf4038867671cff6ffca63c8d637bb95d315cfae79e502a06ab017d85d60c4aa24ce
7
- data.tar.gz: 916fc459bf7f0d00541933d7cbd596cd8991a409de3e655b777a7126b1aa6bd31df52133380e58075bab830c8499cbacee89a5f95b7ee896bfcfa026ba96d909
6
+ metadata.gz: d539813101c69d9c09f710c3dafc8512093b7eb2ad03f3dc759d04d435930dadc856cb56117a1668df0349245d3bdeba37731c51ccaba9a7bdcb9b2f8a0235ef
7
+ data.tar.gz: 552ad4de8ef3a283cb8bdeb965ae2eda83a39c00b15bbaaa501fc6741c29ce512a90e2decc04510db27ef984c209a88c1b5920c1e6a0210c3d8e6b73cdfe6e42
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/ChangeLog CHANGED
@@ -1,5 +1,62 @@
1
+ 2015-02-20 Michael Granger <ged@FaerieMUD.org>
2
+
3
+ * .hgignore, Gemfile, Rakefile, rspec-formatter-webkit.gemspec:
4
+ Update/check in the gemspec and Gemfile.
5
+ [c30cce13579a] [github/master, github/version_3, tip]
6
+
7
+ * History.rdoc, lib/rspec/core/formatters/webkit.rb:
8
+ Bump the minor version, update history.
9
+ [255dd1b2032c]
10
+
11
+ * LICENSE, README.rdoc:
12
+ Update copyright dates
13
+ [2a42400efa2a]
14
+
15
+ * .rvmrc, Gemfile, Rakefile:
16
+ Update to Ruby 2.2, RSpec 3.2.
17
+ [81800976779a]
18
+
19
+ * data/rspec-formatter-webkit/templates/pending-fixed.rhtml,
20
+ lib/rspec/core/formatters/webkit.rb:
21
+ Handle a few changes/idiosyncrasies in some versions of RSpec
22
+ [45fc9fe28daf]
23
+
24
+ 2014-06-10 Michael Granger <ged@FaerieMUD.org>
25
+
26
+ * .rvm.gems, data/rspec-formatter-webkit/templates/failed.rhtml, data
27
+ /rspec-formatter-webkit/templates/passed.rhtml, data/rspec-
28
+ formatter-webkit/templates/pending-fixed.rhtml, data/rspec-
29
+ formatter-webkit/templates/pending.rhtml:
30
+ Update templates for RSpec 3.
31
+ [845600981fbe]
32
+
33
+ 2014-06-05 Michael Granger <ged@FaerieMUD.org>
34
+
35
+ * Gemfile, Rakefile, lib/rspec/core/formatters/webkit.rb:
36
+ Update for RSpec 3.0.0.
37
+ [33aa6f0fa4ec]
38
+
1
39
  2014-02-25 Michael Granger <ged@FaerieMUD.org>
2
40
 
41
+ * Merged changes from default
42
+ [29747e7e68f9]
43
+
44
+ * README.rdoc:
45
+ Update the README
46
+ [d9e33863a314]
47
+
48
+ * .hgtags:
49
+ Added tag v2.4.0 for changeset c13df60f1d07
50
+ [9473701f91f7]
51
+
52
+ * .hgsigs:
53
+ Added signature for changeset 305c5b7f2ed0
54
+ [c13df60f1d07] [v2.4.0]
55
+
56
+ * .hoerc:
57
+ Add gemspec and Gemfile to the Hoe's ignorelist
58
+ [305c5b7f2ed0]
59
+
3
60
  * data/rspec-formatter-webkit/css/textmate-rspec.css, data/rspec-
4
61
  formatter-webkit/templates/deprecations.rhtml, data/rspec-formatter-
5
62
  webkit/templates/error.rhtml, data/rspec-formatter-
@@ -9,7 +66,7 @@
9
66
  webkit/templates/seed.rhtml, data/rspec-formatter-
10
67
  webkit/templates/summary.rhtml, lib/rspec/core/formatters/webkit.rb:
11
68
  Synched up with work done in the RSpec3 tmbundle
12
- [8b6626a85d28] [tip]
69
+ [8b6626a85d28]
13
70
 
14
71
  * History.rdoc:
15
72
  Clarify history message
@@ -45,7 +102,7 @@
45
102
 
46
103
  * .hgignore:
47
104
  Ignore generated .gemspec file
48
- [7869b76132c1] [github/master]
105
+ [7869b76132c1]
49
106
 
50
107
  * .rvm.gems, .rvmrc:
51
108
  Adding RVM config
data/History.rdoc CHANGED
@@ -1,3 +1,9 @@
1
+ == v2.5.0 [2015-02-20] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ - Update to Ruby 2.2, RSpec 3.2.
4
+ - Handle a few changes/idiosyncrasies in some versions of RSpec
5
+
6
+
1
7
  == v2.4.0 [2014-02-24] Michael Granger <ged@FaerieMUD.org>
2
8
 
3
9
  - Fix backtrace links for newer 2.x RSpecs
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009-2010, Michael Granger
1
+ Copyright (c) 2009-2015, Michael Granger
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
data/Manifest.txt CHANGED
@@ -36,6 +36,8 @@ data/rspec-formatter-webkit/images/ticket_plus.png
36
36
  data/rspec-formatter-webkit/images/ticket_small.png
37
37
  data/rspec-formatter-webkit/js/jquery-2.1.0.min.js
38
38
  data/rspec-formatter-webkit/js/textmate-rspec.js
39
+ data/rspec-formatter-webkit/templates/deprecations.rhtml
40
+ data/rspec-formatter-webkit/templates/error.rhtml
39
41
  data/rspec-formatter-webkit/templates/failed.rhtml
40
42
  data/rspec-formatter-webkit/templates/footer.rhtml
41
43
  data/rspec-formatter-webkit/templates/header.rhtml
@@ -43,6 +45,8 @@ data/rspec-formatter-webkit/templates/page.rhtml
43
45
  data/rspec-formatter-webkit/templates/passed.rhtml
44
46
  data/rspec-formatter-webkit/templates/pending-fixed.rhtml
45
47
  data/rspec-formatter-webkit/templates/pending.rhtml
48
+ data/rspec-formatter-webkit/templates/seed.rhtml
49
+ data/rspec-formatter-webkit/templates/summary.rhtml
46
50
  docs/tmrspec-example.png
47
51
  docs/tmrspecopts-shellvar.png
48
52
  lib/rspec/core/formatters/web_kit.rb
data/README.rdoc CHANGED
@@ -47,52 +47,30 @@ example line:
47
47
 
48
48
  Thread.current['logger-output'] << %{<p>Some stuff happened.</p>}
49
49
 
50
- Each line that has such logging appended will appear with
51
- an asterisk after it in the output.
50
+ Each line that has such logging appended will appear with an asterisk after it
51
+ in the output.
52
52
 
53
53
  ==== Loggability
54
54
 
55
- If you're using Loggability for logging, the WebKit formatter has CSS rules
56
- for the output of its HTML formatter. You can inject logs into the spec output
57
- with the following helper methods:
55
+ If you're using Loggability for logging, the WebKit formatter has CSS rules for
56
+ the output of its HTML formatter, and includes a helper for injecting the logs
57
+ generated for an example into the output. Just include the Loggability spec
58
+ helper in your RSpec config:
58
59
 
59
- ### Reset the logging subsystem to its default state.
60
- def reset_logging
61
- Loggability.format_as( :color )
62
- Loggability.output_to( $stderr )
63
- Loggability.level = :fatal
64
- end
60
+ require 'rspec'
61
+ require 'loggability/spechelpers'
65
62
 
66
-
67
- ### Alter the output of the default log formatter to be pretty in SpecMate output
68
- def setup_logging( level=:fatal )
69
-
70
- # Only do this when executing from a spec in TextMate or when
71
- # HTML_LOGGING=1 is set in the environment
72
- if ENV['HTML_LOGGING'] ||
73
- (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\.rb/)
74
- logarray = []
75
- Thread.current['logger-output'] = logarray
76
- Loggability.output_to( logarray )
77
- Loggability.format_as( :html )
78
- Loggability.level = :debug
79
- else
80
- Loggability.level = level
81
- end
82
- end
83
-
84
- Then, in your examples:
85
-
86
- before( :all ) { setup_logging }
87
- after( :all ) { reset_logging }
63
+ RSpec.configure do |config|
64
+ config.include( Loggability::SpecHelpers )
65
+ end
88
66
 
89
67
 
90
68
  == Miscellaneous
91
69
 
92
- It's also usable anywhere else the standard HTML formatter is, of course.
93
- Also, while it's specifically intended to be used under the Textmate HTML
94
- viewer that the RSpec bundle uses, the output should work fine under recent
95
- Gecko/Firefox-based viewers, as well.
70
+ This formatter is also usable anywhere else the standard HTML formatter is, of
71
+ course. Also, while it's specifically intended to be used under the Textmate
72
+ HTML viewer that the RSpec bundle uses, the output should work fine under
73
+ recent Gecko/Firefox-based viewers, as well.
96
74
 
97
75
  Patches/suggestions welcomed.
98
76
 
@@ -112,7 +90,7 @@ This task will install any missing dependencies and generate the API documentati
112
90
 
113
91
  == License
114
92
 
115
- Copyright (c) 2009-2012, Michael Granger
93
+ Copyright (c) 2009-2015, Michael Granger
116
94
  All rights reserved.
117
95
 
118
96
  Redistribution and use in source and binary forms, with or without
data/Rakefile CHANGED
@@ -12,7 +12,6 @@ require 'rake/clean'
12
12
 
13
13
  Hoe.plugin :mercurial
14
14
  Hoe.plugin :signing
15
- Hoe.plugin :bundler
16
15
 
17
16
  Hoe.plugins.delete :rubyforge
18
17
 
@@ -20,11 +19,12 @@ hoespec = Hoe.spec 'rspec-formatter-webkit' do
20
19
  self.readme_file = 'README.rdoc'
21
20
  self.history_file = 'History.rdoc'
22
21
  self.extra_rdoc_files = Rake::FileList[ '*.rdoc' ]
22
+ self.license 'BSD'
23
23
 
24
24
  self.developer 'Michael Granger', 'ged@FaerieMUD.org'
25
25
  self.license 'Ruby'
26
26
 
27
- self.dependency 'rspec-core', '~> 2.14'
27
+ self.dependency 'rspec-core', '~> 3.2'
28
28
  self.dependency 'hoe-bundler', '~> 1.2', :development
29
29
 
30
30
  self.spec_extras[:post_install_message] = %{
@@ -38,7 +38,7 @@ hoespec = Hoe.spec 'rspec-formatter-webkit' do
38
38
 
39
39
  }.gsub( /^\t+/m, '' )
40
40
 
41
- self.require_ruby_version( '>=1.9.3' )
41
+ self.require_ruby_version( '>=2.0.0' )
42
42
  self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags )
43
43
  self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
44
44
  end
@@ -46,7 +46,7 @@ end
46
46
  ENV['VERSION'] ||= hoespec.spec.version.to_s
47
47
 
48
48
  # Ensure history is updated before checking in
49
- task 'hg:precheckin' => [ :check_history, 'Gemfile' ]
49
+ task 'hg:precheckin' => [ :check_history, :gemspec ]
50
50
 
51
51
  task :legacy_gem do
52
52
  Dir.chdir( 'legacy' ) do
@@ -56,13 +56,9 @@ end
56
56
  CLEAN.include( 'legacy/pkg' )
57
57
 
58
58
 
59
- file 'Gemfile'
60
- task 'Gemfile' => ['bundler:gemfile']
61
-
62
-
63
59
  task :gemspec => GEMSPEC
64
60
 
65
- desc "generate a gemspec from your Hoe.spec"
61
+ desc "Refresh the .gemspec"
66
62
  file GEMSPEC => 'Rakefile' do |task|
67
63
  spec = hoespec.spec.dup
68
64
  spec.files.delete( '.gemtest' )
@@ -72,5 +68,5 @@ file GEMSPEC => 'Rakefile' do |task|
72
68
  fh.write( spec.to_ruby )
73
69
  end
74
70
  end
75
-
71
+ CLOBBER.include( '*.gemspec' )
76
72
 
@@ -72,16 +72,31 @@ pre, code {
72
72
  margin-top: 120px;
73
73
  }
74
74
 
75
- #summary {
75
+ #summary, #deprecation-warnings {
76
76
  margin: 0;
77
77
  padding: 1em 3em;
78
78
  background-color: rgb(101, 111, 130);
79
79
  color: white;
80
80
  }
81
- #summary p {
81
+ #summary p, #deprecation-warnings p {
82
82
  margin: 0;
83
83
  }
84
84
 
85
+ #seed {
86
+ position: absolute;
87
+ top: 1.5em;
88
+ right: 4em;
89
+ color: white;
90
+ text-shadow: black 0 1px 3px;
91
+ }
92
+
93
+ #error {
94
+ margin: 2em;
95
+ background: #ffeeee;
96
+ border: 1px solid black;
97
+ padding: 1em;
98
+ }
99
+
85
100
  .rspec-graph-legend-item {
86
101
  display: inline-block;
87
102
  font-weight: bold;
@@ -343,3 +358,30 @@ div.log-message.fatal .log-name,
343
358
  div.fatal-log-message .log-name {
344
359
  color: white;
345
360
  }
361
+
362
+
363
+ /* Deprecations */
364
+
365
+ dl.deprecations a {
366
+ }
367
+
368
+ dl.deprecations dt,
369
+ dl.deprecations dd {
370
+ background: #ccc;
371
+ padding: 2px 20px;
372
+ }
373
+ dl.deprecations dt {
374
+ background-image: url(../images/ticket.png);
375
+ background-repeat: no-repeat;
376
+ background-position: 2px 2px;
377
+ color: #333;
378
+ border-top: 1px solid #ACACAC;
379
+ }
380
+ dl.deprecations dd {
381
+ font-size: 80%;
382
+ background: #ccc;
383
+ color: #666;
384
+ margin: 0;
385
+ }
386
+
387
+
@@ -0,0 +1,19 @@
1
+ <div id="deprecation-warnings">
2
+ <p><strong><%= deprecations.size %> Deprecation Warnings</strong></p>
3
+ <dl class="deprecations">
4
+ % deprecations.each do |dep|
5
+ % if dep.deprecated
6
+ <dt><%= h dep.message || dep.deprecated %></dt>
7
+ % if dep.replacement
8
+ <dd class="replacement">Use <%= h dep.replacement %> instead.</dd>
9
+ % end
10
+ <dd class="call-site">at <%= link_backtrace_line dep.call_site %></dd>
11
+ % elsif dep.message =~ /^-+\n(.*?)\(Used from (.*)\)\n-+/m
12
+ % desc, call_site = $1, $2
13
+ <dt><%= h desc.gsub(/\n/, ' ') %></dt>
14
+ <dd class="call-site">at <%= link_backtrace_line call_site %></dd>
15
+ % end
16
+ % end
17
+
18
+ </dl>
19
+ </div>
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>RSpec results</title>
5
+
6
+ <meta charset="utf-8">
7
+ <meta http-equiv="Expires" content="-1">
8
+ <meta http-equiv="Pragma" content="no-cache">
9
+
10
+ <base href="<%= BASE_HREF %>">
11
+
12
+ <link rel="stylesheet" href="css/textmate-rspec.css">
13
+ </head>
14
+ <body>
15
+
16
+ <div id="error">
17
+ <h1>Internal Error</h1>
18
+
19
+ <p>Sorry, there was a problem running RSpec.</p>
20
+
21
+ <div class="error-details">
22
+ <%= message.split($/).map {|line| h line }.join('<br>') %>
23
+ </div>
24
+ </div>
25
+
26
+ </body>
27
+ </html>
@@ -1,23 +1,17 @@
1
1
 
2
2
  <dd class="spec failed">
3
3
  <span class="spec-name"><%= h(example.description) %></span>
4
- <span class="spec-time"><%= h("%0.5fs" % [example.execution_result[:run_time]]) %></span>
4
+ <span class="spec-time"><%= h("%0.5fs" % [example.execution_result.run_time]) %></span>
5
5
  <div class="failure" id="failure-<%= counter %>">
6
6
 
7
- <div class="message">Failure/Error:
8
- <code><%= h read_failed_line(exception, example).strip.gsub(/\n/, '<br />') %><br />
9
- % exception.message.split("\n").each do |line|
10
- <%= h line %><br />
11
- % end
12
- % if group = find_shared_group( example )
13
- Shared Example Group: "<%= h group.metadata[:shared_group_name] %>" called from
14
- "<%= backtrace_line(group.metadata[:example_group][:location]) %>
15
- % end
16
- </code>
17
- </div>
7
+ <div class="message"><code>
8
+ % notification.message_lines.each do |line|
9
+ <%= h line %><br />
10
+ % end
11
+ </code></div>
18
12
 
19
13
  <div class="backtrace"><p><code>
20
- % format_backtrace(exception.backtrace, example).each do |backtrace_info|
14
+ % format_backtrace(notification).each do |backtrace_info|
21
15
  <span class="backtrace-frame"><%= backtrace_info %></span><br />
22
16
  % end
23
17
  </code></p></div>
@@ -1,9 +1,3 @@
1
- </div>
2
-
3
- <div id="summary">
4
- <p><%= example_count %> examples run in <span class="duration"><%= duration %>
5
- seconds</span>. <%= failure_count %> failed, <%= pending_count %> are pending.</p>
6
- </div>
7
1
 
8
2
  </body>
9
3
  </html>
@@ -1,29 +1,31 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
-
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
1
+ <!DOCTYPE html>
2
+ <html lang="en">
5
3
  <head>
6
4
  <title>RSpec results</title>
7
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+
6
+ <meta charset="utf-8">
8
7
  <meta http-equiv="Expires" content="-1" />
9
8
  <meta http-equiv="Pragma" content="no-cache" />
10
9
 
11
10
  <base href="<%= BASE_HREF %>" />
12
11
 
13
12
  <link rel="stylesheet" href="css/textmate-rspec.css" type="text/css" media="screen"
14
- title="no title" charset="utf-8" />
13
+ charset="utf-8" />
15
14
 
16
15
  <script type="text/javascript" charset="utf-8" src="js/jquery-2.1.0.min.js"></script>
17
- <script defer="defer" type="text/javascript" charset="utf-8" src="js/textmate-rspec.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="js/textmate-rspec.js"></script>
18
17
  </head>
19
18
  <body>
20
19
  <div class="rspec-report">
21
20
 
21
+ <!-- RSpec version: <%= RSpec::Core::Version::STRING %> -->
22
+
22
23
  <div id="rspec-header">
23
24
  <div id="rspec-title-section">
24
25
  <h1>RSpec Results:</h1>
25
- <span id="rspec-summary-stats">Running (<span id="spec-count"><%= example_count %></span>
26
- examples)...</span>
26
+ <span id="rspec-summary-stats">
27
+ Running (<span id="spec-count"><%= notification.count %></span> examples)...
28
+ </span>
27
29
  </div>
28
30
 
29
31
  <div id="rspec-summary">
@@ -1,6 +1,6 @@
1
1
  <dd class="spec passed">
2
2
  <span class="spec-name"><%= h(example.description) %></span>
3
- <span class="spec-time"><%= h("%0.5fs" % [example.execution_result[:run_time]]) %></span>
3
+ <span class="spec-time"><%= h("%0.5fs" % [example.execution_result.run_time]) %></span>
4
4
 
5
5
  % unless log_messages.nil? || log_messages.empty?
6
6
  <div class="log-messages">
@@ -1,17 +1,17 @@
1
1
 
2
2
  <dd class="spec pending-fixed">
3
3
  <span class="spec-name"><%= h(example.description) %></span>
4
- <span class="spec-time"><%= h("%0.5fs" % [example.execution_result[:run_time]]) %></span>
4
+ <span class="spec-time"><%= h("%0.5fs" % [example.execution_result.run_time]) %></span>
5
5
 
6
6
  <div class="failure" id="failure-<%= counter %>">
7
7
 
8
8
  <div class="message">Expected pending
9
- <code><%= h(example.metadata[:execution_result][:pending_message]) %></code>
9
+ <code><%= h(example.execution_result.pending_message) %></code>
10
10
  to fail. No Error was raised.
11
11
  </div>
12
12
 
13
13
  <div class="backtrace"><p><code>
14
- % format_backtrace(exception.backtrace, example).each do |backtrace_info|
14
+ % format_backtrace(notification).each do |backtrace_info|
15
15
  <span class="backtrace-frame"><%= backtrace_info %></span><br />
16
16
  % end
17
17
  </code></p></div>
@@ -2,9 +2,9 @@
2
2
  <dd class="spec pending">
3
3
  <span class="spec-name"><%= h(example.description) %></span>
4
4
  <span class="pending-message">
5
- (Pending <%= example.execution_result[:pending_message] %>)
5
+ (Pending <%= example.execution_result.pending_message %>)
6
6
  </span>
7
- <span class="spec-time"><%= h("%0.5fs" % [example.execution_result[:run_time]]) %></span>
7
+ <span class="spec-time"><%= h("%0.5fs" % [example.execution_result.run_time]) %></span>
8
8
 
9
9
  % unless log_messages.nil? || log_messages.empty?
10
10
  <div class="log-messages">
@@ -0,0 +1,3 @@
1
+ <div id="seed">
2
+ <strong>Random seed:</strong> <code><%= notification.seed %></code>
3
+ </div>
@@ -0,0 +1,9 @@
1
+ </div> <!-- closes rspec-details -->
2
+
3
+ <div id="summary">
4
+ <p><%= summary.example_count %> examples run in
5
+ <span class="duration"><%= summary.duration %>
6
+ seconds</span>. <%= summary.failure_count %> failed,
7
+ <%= summary.pending_count %> are pending.</p>
8
+ </div>
9
+
@@ -3,18 +3,29 @@
3
3
  require 'pp'
4
4
  require 'erb'
5
5
  require 'pathname'
6
+ require 'set'
7
+
8
+ gem 'rspec', '> 2.99'
6
9
 
7
10
  require 'rspec'
8
11
  require 'rspec/core/formatters/base_text_formatter'
9
12
  require 'rspec/core/formatters/snippet_extractor'
10
13
  require 'rspec/core/pending'
11
14
 
15
+ # Work around a bug in the null colorizer.
16
+ module NullColorizerFix
17
+ def wrap( line, _ )
18
+ line
19
+ end
20
+ end
21
+ RSpec::Core::Notifications::NullColorizer.extend( NullColorizerFix )
22
+
12
23
 
13
- class RSpec::Core::Formatters::WebKit < RSpec::Core::Formatters::BaseTextFormatter
24
+ class RSpec::Core::Formatters::WebKit < RSpec::Core::Formatters::BaseFormatter
14
25
  include ERB::Util
15
26
 
16
27
  # Version constant
17
- VERSION = '2.4.0'
28
+ VERSION = '2.5.0'
18
29
 
19
30
  # Look up the datadir falling back to a relative path (mostly for prerelease testing)
20
31
  DATADIR = begin
@@ -36,8 +47,12 @@ class RSpec::Core::Formatters::WebKit < RSpec::Core::Formatters::BaseTextFormatt
36
47
  FAILED_EXAMPLE_TEMPLATE = TEMPLATE_DIR + 'failed.rhtml'
37
48
  PENDING_EXAMPLE_TEMPLATE = TEMPLATE_DIR + 'pending.rhtml'
38
49
  PENDFIX_EXAMPLE_TEMPLATE = TEMPLATE_DIR + 'pending-fixed.rhtml'
50
+ SUMMARY_TEMPLATE = TEMPLATE_DIR + 'summary.rhtml'
51
+ DEPRECATIONS_TEMPLATE = TEMPLATE_DIR + 'deprecations.rhtml'
52
+ SEED_TEMPLATE = TEMPLATE_DIR + 'seed.rhtml'
39
53
  FOOTER_TEMPLATE = TEMPLATE_DIR + 'footer.rhtml'
40
54
 
55
+
41
56
  # Pattern to match for excluding lines from backtraces
42
57
  BACKTRACE_EXCLUDE_PATTERN = %r{spec/mate|textmate-command|rspec(-(core|expectations|mocks))?/}
43
58
 
@@ -49,11 +64,26 @@ class RSpec::Core::Formatters::WebKit < RSpec::Core::Formatters::BaseTextFormatt
49
64
  end
50
65
 
51
66
 
67
+ # Register this formatter with RSpec
68
+ RSpec::Core::Formatters.register self,
69
+ :start,
70
+ :example_group_started,
71
+ :start_dump,
72
+ :example_started,
73
+ :example_passed,
74
+ :example_failed,
75
+ :example_pending,
76
+ :dump_summary,
77
+ :deprecation,
78
+ :deprecation_summary,
79
+ :seed,
80
+ :close
81
+
82
+
52
83
  ### Create a new formatter
53
84
  def initialize( output ) # :notnew:
54
85
  super
55
86
  @previous_nesting_depth = 0
56
- @example_number = 0
57
87
  @failcounter = 0
58
88
  @snippet_extractor = RSpec::Core::Formatters::SnippetExtractor.new
59
89
  @example_templates = {
@@ -63,6 +93,12 @@ class RSpec::Core::Formatters::WebKit < RSpec::Core::Formatters::BaseTextFormatt
63
93
  :pending_fixed => self.load_template(PENDFIX_EXAMPLE_TEMPLATE),
64
94
  }
65
95
 
96
+ @deprecation_stream = []
97
+ @summary_stream = []
98
+ @failed_examples = []
99
+
100
+ @deprecations = Set.new
101
+
66
102
  Thread.current['logger-output'] = []
67
103
  end
68
104
 
@@ -72,22 +108,40 @@ class RSpec::Core::Formatters::WebKit < RSpec::Core::Formatters::BaseTextFormatt
72
108
  ######
73
109
 
74
110
  # Attributes made readable for ERb
75
- attr_reader :example_group_number, :example_number, :example_count
111
+ attr_reader :example_count
76
112
 
77
113
  # The counter for failed example IDs
78
114
  attr_accessor :failcounter
79
115
 
116
+ # The Set of deprecation notifications
117
+ attr_reader :deprecations
118
+
119
+ # The Array of failed examples
120
+ attr_reader :failed_examples
121
+
122
+
123
+ ### Fetch any log messages added to the thread-local Array
124
+ def log_messages
125
+ return Thread.current[ 'logger-output' ] ||= []
126
+ end
127
+
128
+
129
+ #
130
+ # Formatter notification callbacks
131
+ #
80
132
 
81
133
  ### Start the page by rendering the header.
82
- def start( example_count )
83
- @output.puts self.render_header( example_count )
134
+ def start( notification )
135
+ super
136
+ @output.puts self.render_header( notification )
84
137
  @output.flush
85
138
  end
86
139
 
87
140
 
88
141
  ### Callback called by each example group when it's entered --
89
- def example_group_started( example_group )
142
+ def example_group_started( notification )
90
143
  super
144
+ example_group = notification.group
91
145
  nesting_depth = example_group.ancestors.length
92
146
 
93
147
  # Close the previous example groups if this one isn't a
@@ -115,17 +169,10 @@ class RSpec::Core::Formatters::WebKit < RSpec::Core::Formatters::BaseTextFormatt
115
169
  ]
116
170
  @output.flush
117
171
  end
118
- alias_method :add_example_group, :example_group_started
119
-
120
-
121
- ### Fetch any log messages added to the thread-local Array
122
- def log_messages
123
- return Thread.current[ 'logger-output' ] || []
124
- end
125
172
 
126
173
 
127
174
  ### Callback -- called when the examples are finished.
128
- def start_dump
175
+ def start_dump( notification )
129
176
  @previous_nesting_depth.downto( 1 ) do |i|
130
177
  @output.puts " </dl>",
131
178
  "</section>"
@@ -137,15 +184,14 @@ class RSpec::Core::Formatters::WebKit < RSpec::Core::Formatters::BaseTextFormatt
137
184
 
138
185
 
139
186
  ### Callback -- called when an example is entered
140
- def example_started( example )
141
- @example_number += 1
142
- Thread.current[ 'logger-output' ] ||= []
143
- Thread.current[ 'logger-output' ].clear
187
+ def example_started( notification )
188
+ self.log_messages.clear
144
189
  end
145
190
 
146
191
 
147
192
  ### Callback -- called when an example is exited with no failures.
148
- def example_passed( example )
193
+ def example_passed( notification )
194
+ example = notification.example
149
195
  status = 'passed'
150
196
  @output.puts( @example_templates[:passed].result(binding()) )
151
197
  @output.flush
@@ -153,11 +199,13 @@ class RSpec::Core::Formatters::WebKit < RSpec::Core::Formatters::BaseTextFormatt
153
199
 
154
200
 
155
201
  ### Callback -- called when an example is exited with a failure.
156
- def example_failed( example )
157
- super
202
+ def example_failed( notification )
203
+ example = notification.example
158
204
 
159
- counter = self.failcounter += 1
160
- exception = example.metadata[:execution_result][:exception]
205
+ self.failed_examples << example
206
+ counter = self.failed_examples.size
207
+
208
+ exception = notification.exception
161
209
  extra = self.extra_failure_content( exception )
162
210
  template = if exception.is_a?( PENDING_FIXED_EXCEPTION )
163
211
  then @example_templates[:pending_fixed]
@@ -170,22 +218,73 @@ class RSpec::Core::Formatters::WebKit < RSpec::Core::Formatters::BaseTextFormatt
170
218
 
171
219
 
172
220
  ### Callback -- called when an example is exited via a 'pending'.
173
- def example_pending( example )
221
+ def example_pending( notification )
222
+ example = notification.example
174
223
  status = 'pending'
175
224
  @output.puts( @example_templates[:pending].result(binding()) )
176
225
  @output.flush
177
226
  end
178
227
 
179
228
 
180
- ### Format backtrace lines to include a textmate link to the file/line in question.
181
- def backtrace_line( line )
182
- return nil unless line = super
183
- return nil if line =~ BACKTRACE_EXCLUDE_PATTERN
184
- return line.strip.gsub( /(?<filename>[^:]*\.rb):(?<line>\d*)/ ) do
229
+ ### Output the content generated at the end of the run.
230
+ def dump_summary( summary )
231
+ html = self.render_summary( summary )
232
+ @output.puts( html )
233
+ @output.flush
234
+ end
235
+
236
+
237
+ ### Callback -- Add a deprecation warning.
238
+ def deprecation( notification )
239
+ @deprecations.add( notification )
240
+ end
241
+
242
+
243
+ ### Callback -- Called at the end with a summary of any deprecations encountered
244
+ ### during the run.
245
+ def deprecation_summary( notification )
246
+ html = self.render_deprecations
247
+ @output.puts( html )
248
+ @output.flush
249
+ end
250
+
251
+
252
+ ### Callback -- called with the random seed if the test suite is run with random ordering.
253
+ def seed( notification )
254
+ return unless notification.seed_used?
255
+ html = self.render_seed( notification )
256
+ @output.puts( html )
257
+ end
258
+
259
+
260
+ ### Callback -- called at the very end.
261
+ def close( notification )
262
+ footer = self.render_footer( notification )
263
+ @output.puts( footer )
264
+ @output.flush
265
+ end
266
+
267
+
268
+ #
269
+ # Utility methods
270
+ #
271
+
272
+ ### Overriden to add txmt: links to the file paths in the backtrace.
273
+ def format_backtrace( notification )
274
+ lines = notification.formatted_backtrace
275
+ return lines.map do |line|
276
+ link_backtrace_line( line )
277
+ end
278
+ end
279
+
280
+
281
+ ### Link the filename and line number in the given +line+ from a backtrace.
282
+ def link_backtrace_line( line )
283
+ return line.strip.sub( /(?<filename>[^:]*\.rb):(?<line>\d*)(?<rest>.*)/ ) do
185
284
  match = $~
186
285
  fullpath = File.expand_path( match[:filename] )
187
- %|<a href="txmt://open?url=file://%s&amp;line=%s">%s:%s</a>| %
188
- [ fullpath, match[:line], match[:filename], match[:line] ]
286
+ %|<a href="txmt://open?url=file://%s&amp;line=%s">%s:%s</a>%s| %
287
+ [ fullpath, match[:line], match[:filename], match[:line], h(match[:rest]) ]
189
288
  end
190
289
  end
191
290
 
@@ -195,35 +294,57 @@ class RSpec::Core::Formatters::WebKit < RSpec::Core::Formatters::BaseTextFormatt
195
294
  ### failure.
196
295
  def extra_failure_content( exception )
197
296
  return '' unless exception
198
- backtrace = exception.backtrace.find {|line| line !~ BACKTRACE_EXCLUDE_PATTERN }
199
- # $stderr.puts "Using backtrace line %p to extract snippet" % [ backtrace ]
200
- snippet = @snippet_extractor.snippet([ backtrace ])
201
- return " <pre class=\"ruby\"><code>#{snippet}</code></pre>"
202
- end
203
297
 
298
+ backtrace = exception.backtrace.map do |line|
299
+ RSpec.configuration.backtrace_formatter.backtrace_line( line )
300
+ end.compact
204
301
 
205
- ### Returns content to be output when a failure occurs during the run; overridden to
206
- ### do nothing, as failures are handled by #example_failed.
207
- def dump_failures( *unused )
302
+ snippet = @snippet_extractor.snippet( backtrace )
303
+ return " <pre class=\"ruby\"><code>#{snippet}</code></pre>"
208
304
  end
209
305
 
210
306
 
211
- ### Output the content generated at the end of the run.
212
- def dump_summary( duration, example_count, failure_count, pending_count )
213
- @output.puts self.render_footer( duration, example_count, failure_count, pending_count )
214
- @output.flush
307
+ ### Find the innermost shared example group for the given +example+.
308
+ def find_shared_group( example )
309
+ groups = example.example_group.parent_groups + [example.example_group]
310
+ return groups.find {|group| group.metadata[:shared_group_name]}
215
311
  end
216
312
 
217
313
 
314
+ #
315
+ # Template methods
316
+ #
317
+
218
318
  ### Render the header template in the context of the receiver.
219
- def render_header( example_count )
319
+ def render_header( notification )
220
320
  template = self.load_template( HEADER_TEMPLATE )
221
321
  return template.result( binding() )
222
322
  end
223
323
 
224
324
 
325
+ ### Render the summary template in the context of the receiver.
326
+ def render_summary( summary )
327
+ template = self.load_template( SUMMARY_TEMPLATE )
328
+ return template.result( binding() )
329
+ end
330
+
331
+
332
+ ### Render the deprecation summary template in the context of the receiver.
333
+ def render_deprecations
334
+ template = self.load_template( DEPRECATIONS_TEMPLATE )
335
+ return template.result( binding() )
336
+ end
337
+
338
+
339
+ ### Render the seed template in the context of the receiver.
340
+ def render_seed( notification )
341
+ template = self.load_template( SEED_TEMPLATE )
342
+ return template.result( binding() )
343
+ end
344
+
345
+
225
346
  ### Render the footer template in the context of the receiver.
226
- def render_footer( duration, example_count, failure_count, pending_count )
347
+ def render_footer( notification )
227
348
  template = self.load_template( FOOTER_TEMPLATE )
228
349
  return template.result( binding() )
229
350
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-formatter-webkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
@@ -12,7 +12,7 @@ cert_chain:
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIDbDCCAlSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA+MQwwCgYDVQQDDANnZWQx
14
14
  GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
15
- HhcNMTMwMjI3MTY0ODU4WhcNMTQwMjI3MTY0ODU4WjA+MQwwCgYDVQQDDANnZWQx
15
+ HhcNMTQwMzE5MDQzNTI2WhcNMTUwMzE5MDQzNTI2WjA+MQwwCgYDVQQDDANnZWQx
16
16
  GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
17
17
  ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDb92mkyYwuGBg1oRxt2tkH
18
18
  +Uo3LAsaL/APBfSLzy8o3+B3AUHKCjMUaVeBoZdWtMHB75X3VQlvXfZMyBxj59Vo
@@ -23,99 +23,113 @@ cert_chain:
23
23
  AgMBAAGjdTBzMAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBSZ0hCV
24
24
  qoHr122fGKelqffzEQBhszAcBgNVHREEFTATgRFnZWRARmFlcmllTVVELm9yZzAc
25
25
  BgNVHRIEFTATgRFnZWRARmFlcmllTVVELm9yZzANBgkqhkiG9w0BAQUFAAOCAQEA
26
- Vlcfyq6GwyE8i0QuFPCeVOwJaneSvcwx316DApjy9/tt2YD2HomLbtpXtji5QXor
27
- ON6oln4tWBIB3Klbr3szq5oR3Rc1D02SaBTalxSndp4M6UkW9hRFu5jn98pDB4fq
28
- 5l8wMMU0Xdmqx1VYvysVAjVFVC/W4NNvlmg+2mEgSVZP5K6Tc9qDh3eMQInoYw6h
29
- t1YA6RsUJHp5vGQyhP1x34YpLAaly8icbns/8PqOf7Osn9ztmg8bOMJCeb32eQLj
30
- 6mKCwjpegytE0oifXfF8k75A9105cBnNiMZOe1tXiqYc/exCgWvbggurzDOcRkZu
31
- /YSusaiDXHKU2O3Akc3htA==
26
+ TuL1Bzl6TBs1YEzEubFHb9XAPgehWzzUudjDKzTRd+uyZmxnomBqTCQjT5ucNRph
27
+ 3jZ6bhLNooLQxTjIuHodeGcEMHZdt4Yi7SyPmw5Nry12z6wrDp+5aGps3HsE5WsQ
28
+ Zq2EuyEOc96g31uoIvjNdieKs+1kE+K+dJDjtw+wTH2i63P7r6N/NfPPXpxsFquo
29
+ wcYRRrHdR7GhdJeT+V8Q8Bi5bglCUGdx+8scMgkkePc98k9osQHypbACmzO+Bqkv
30
+ c7ZKPJcWBv0sm81+FCZXNACn2f9jfF8OQinxVs0O052KbGuEQaaiGIYeuuwQE2q6
31
+ ggcrPfcYeTwWlfZPu2LrBg==
32
32
  -----END CERTIFICATE-----
33
- date: 2014-02-26 00:00:00.000000000 Z
33
+ date: 2015-02-21 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: rspec-core
37
37
  requirement: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '2.14'
41
+ version: '3.2'
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '2.14'
48
+ version: '3.2'
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: hoe-mercurial
51
51
  requirement: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: 1.4.0
55
+ version: '1.4'
56
56
  type: :development
57
57
  prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ~>
60
+ - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: 1.4.0
62
+ version: '1.4'
63
+ - !ruby/object:Gem::Dependency
64
+ name: hoe-deveiate
65
+ requirement: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '0.6'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '0.6'
63
77
  - !ruby/object:Gem::Dependency
64
78
  name: hoe-highline
65
79
  requirement: !ruby/object:Gem::Requirement
66
80
  requirements:
67
- - - ~>
81
+ - - "~>"
68
82
  - !ruby/object:Gem::Version
69
- version: 0.1.0
83
+ version: '0.2'
70
84
  type: :development
71
85
  prerelease: false
72
86
  version_requirements: !ruby/object:Gem::Requirement
73
87
  requirements:
74
- - - ~>
88
+ - - "~>"
75
89
  - !ruby/object:Gem::Version
76
- version: 0.1.0
90
+ version: '0.2'
77
91
  - !ruby/object:Gem::Dependency
78
92
  name: rdoc
79
93
  requirement: !ruby/object:Gem::Requirement
80
94
  requirements:
81
- - - ~>
95
+ - - "~>"
82
96
  - !ruby/object:Gem::Version
83
97
  version: '4.0'
84
98
  type: :development
85
99
  prerelease: false
86
100
  version_requirements: !ruby/object:Gem::Requirement
87
101
  requirements:
88
- - - ~>
102
+ - - "~>"
89
103
  - !ruby/object:Gem::Version
90
104
  version: '4.0'
91
105
  - !ruby/object:Gem::Dependency
92
106
  name: hoe-bundler
93
107
  requirement: !ruby/object:Gem::Requirement
94
108
  requirements:
95
- - - ~>
109
+ - - "~>"
96
110
  - !ruby/object:Gem::Version
97
111
  version: '1.2'
98
112
  type: :development
99
113
  prerelease: false
100
114
  version_requirements: !ruby/object:Gem::Requirement
101
115
  requirements:
102
- - - ~>
116
+ - - "~>"
103
117
  - !ruby/object:Gem::Version
104
118
  version: '1.2'
105
119
  - !ruby/object:Gem::Dependency
106
120
  name: hoe
107
121
  requirement: !ruby/object:Gem::Requirement
108
122
  requirements:
109
- - - ~>
123
+ - - "~>"
110
124
  - !ruby/object:Gem::Version
111
- version: '3.7'
125
+ version: '3.13'
112
126
  type: :development
113
127
  prerelease: false
114
128
  version_requirements: !ruby/object:Gem::Requirement
115
129
  requirements:
116
- - - ~>
130
+ - - "~>"
117
131
  - !ruby/object:Gem::Version
118
- version: '3.7'
132
+ version: '3.13'
119
133
  description: |-
120
134
  This is a formatter for RSpec 2 that takes advantage of features in
121
135
  WebKit[http://webkit.org/] to make the output from RSpec in Textmate more
@@ -171,6 +185,8 @@ files:
171
185
  - data/rspec-formatter-webkit/images/ticket_small.png
172
186
  - data/rspec-formatter-webkit/js/jquery-2.1.0.min.js
173
187
  - data/rspec-formatter-webkit/js/textmate-rspec.js
188
+ - data/rspec-formatter-webkit/templates/deprecations.rhtml
189
+ - data/rspec-formatter-webkit/templates/error.rhtml
174
190
  - data/rspec-formatter-webkit/templates/failed.rhtml
175
191
  - data/rspec-formatter-webkit/templates/footer.rhtml
176
192
  - data/rspec-formatter-webkit/templates/header.rhtml
@@ -178,35 +194,38 @@ files:
178
194
  - data/rspec-formatter-webkit/templates/passed.rhtml
179
195
  - data/rspec-formatter-webkit/templates/pending-fixed.rhtml
180
196
  - data/rspec-formatter-webkit/templates/pending.rhtml
197
+ - data/rspec-formatter-webkit/templates/seed.rhtml
198
+ - data/rspec-formatter-webkit/templates/summary.rhtml
181
199
  - docs/tmrspec-example.png
182
200
  - docs/tmrspecopts-shellvar.png
183
201
  - lib/rspec/core/formatters/web_kit.rb
184
202
  - lib/rspec/core/formatters/webkit.rb
185
203
  homepage: http://deveiate.org/webkit-rspec-formatter.html
186
204
  licenses:
205
+ - BSD
187
206
  - Ruby
188
207
  metadata: {}
189
208
  post_install_message: "\n\nYou can use this formatter from TextMate by setting the
190
209
  TM_RSPEC_OPTS \nshell variable (in the 'Advanced' preference pane) to:\n\n --format
191
210
  RSpec::Core::Formatters::WebKit\n\nHave fun!\n\n"
192
211
  rdoc_options:
193
- - --main
212
+ - "--main"
194
213
  - README.rdoc
195
214
  require_paths:
196
215
  - lib
197
216
  required_ruby_version: !ruby/object:Gem::Requirement
198
217
  requirements:
199
- - - '>='
218
+ - - ">="
200
219
  - !ruby/object:Gem::Version
201
- version: 1.9.3
220
+ version: 2.0.0
202
221
  required_rubygems_version: !ruby/object:Gem::Requirement
203
222
  requirements:
204
- - - '>='
223
+ - - ">="
205
224
  - !ruby/object:Gem::Version
206
225
  version: '0'
207
226
  requirements: []
208
- rubyforge_project: rspec-formatter-webkit
209
- rubygems_version: 2.2.1
227
+ rubyforge_project:
228
+ rubygems_version: 2.4.5
210
229
  signing_key:
211
230
  specification_version: 4
212
231
  summary: This is a formatter for RSpec 2 that takes advantage of features in WebKit[http://webkit.org/]
metadata.gz.sig CHANGED
Binary file