rspec_html_formatter 0.3.0 → 0.3.1

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: efdf12a1f84026c3df35a259d0b847a6b5359fca
4
- data.tar.gz: 680e387bbd65cefde7d9451501647e0d8d434aa4
3
+ metadata.gz: 3c80e59b0b4984374765cbbf10f633c10efe64f0
4
+ data.tar.gz: 904366bca99f2e0328c437632ca6469fd5185f6f
5
5
  SHA512:
6
- metadata.gz: e5ba8437ba3133e9d6b48a4b32e32dafae6a9954e6937da0f5c435a1ea34b439a54fe0cb28329ac5d39bfb914d68e15fa03d4ff4da994c05612a4c3db17f0183
7
- data.tar.gz: 4ff194e998df173d1373689d41eae2234f1468f1917ff34243d9c66a38a676888e1249228ae4499fa3b226187e3e4495ebebcee4fb9cb99fe7a7ef38fa74bc1b
6
+ metadata.gz: 5bb8571fd93b97b9dac8dc9bfdc5020631f29669cb5b195e259a33b9157968e3c77db4be0e5913d4a5e3ad668565e24d45b113f2594808d65c2231c78f67853b
7
+ data.tar.gz: 10062623df113f856f88a6e7ce977c4efd0e9c7983f62aaf52c582ebe7c9cf993144123ce9b1d0e09683399aab47f40f9d08c14a3a30cffa45005b62b5133fba
data/Gemfile.lock CHANGED
@@ -44,6 +44,8 @@ GEM
44
44
  multipart-post (2.0.0)
45
45
  nokogiri (1.6.3.1)
46
46
  mini_portile (= 0.6.0)
47
+ nokogiri (1.6.3.1-x86-mingw32)
48
+ mini_portile (= 0.6.0)
47
49
  oauth2 (1.0.0)
48
50
  faraday (>= 0.8, < 0.10)
49
51
  jwt (~> 1.0)
@@ -73,6 +75,7 @@ GEM
73
75
 
74
76
  PLATFORMS
75
77
  ruby
78
+ x86-mingw32
76
79
 
77
80
  DEPENDENCIES
78
81
  activesupport (>= 4.1.4)
data/README.md CHANGED
@@ -10,13 +10,13 @@ versions of Rspec then you should use the rspec_reports_formatter 0.2.x (2.8.0 b
10
10
  ## Install
11
11
 
12
12
  ```
13
- gem install rspec_reports_formatter -v 0.3.0
13
+ gem install rspec_html_formatter -v 0.3.1
14
14
  ```
15
15
 
16
16
  ideally just add it to your bundler Gemfile as follows:
17
17
 
18
18
  ```ruby
19
- gem 'rspec_reports_formatter','~> 0.3.0'
19
+ gem 'rspec_html_formatter','~> 0.3.1'
20
20
  ```
21
21
 
22
22
  ## Use
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -5,6 +5,7 @@ require 'active_support/inflector'
5
5
  require 'fileutils'
6
6
  require 'rouge'
7
7
  require 'erb'
8
+ require 'rbconfig'
8
9
 
9
10
  I18n.enforce_available_locales = false
10
11
 
@@ -26,10 +27,34 @@ class Oopsy
26
27
 
27
28
  private
28
29
 
30
+ def os
31
+ @os ||= (
32
+ host_os = RbConfig::CONFIG['host_os']
33
+ case host_os
34
+ when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
35
+ :windows
36
+ when /darwin|mac os/
37
+ :macosx
38
+ when /linux/
39
+ :linux
40
+ when /solaris|bsd/
41
+ :unix
42
+ else
43
+ raise Exception, "unknown os: #{host_os.inspect}"
44
+ end
45
+ )
46
+ end
47
+
29
48
  def process_source
30
49
  data = @backtrace_message.split(':')
31
- file_path = data.first
32
- line_number = data[1].to_i
50
+ unless data.empty?
51
+ if os == :windows
52
+ file_path = data[0] + ':' + data[1]
53
+ line_number = data[2].to_i
54
+ else
55
+ file_path = data.first
56
+ line_number = data[1].to_i
57
+ end
33
58
  lines = File.readlines(file_path)
34
59
  start_line = line_number-2
35
60
  end_line = line_number+3
@@ -37,8 +62,8 @@ class Oopsy
37
62
 
38
63
  formatter = Rouge::Formatters::HTML.new(css_class: 'highlight', line_numbers: true, start_line: start_line+1)
39
64
  lexer = Rouge::Lexers::Ruby.new
40
- formatter.format(lexer.lex(source))
41
-
65
+ formatter.format(lexer.lex(source.encode('utf-8')))
66
+ end
42
67
  end
43
68
 
44
69
  def process_message
@@ -160,13 +185,14 @@ class RspecHtmlFormatter < RSpec::Core::Formatters::BaseFormatter
160
185
  duration_values = @group_examples.map { |e| e.run_time }
161
186
 
162
187
  duration_keys = duration_values.size.times.to_a
163
- if duration_values.size < 2
188
+ if duration_values.size < 2 and duration_values.size > 0
164
189
  duration_values.unshift(duration_values.first)
165
190
  duration_keys = duration_keys << 1
166
191
  end
167
192
 
168
193
  @title = notification.group.description
169
194
  @durations = duration_keys.zip(duration_values)
195
+
170
196
  @summary_duration = duration_values.inject(0) { |sum, i| sum + i }.to_s(:rounded, precision: 5)
171
197
  @examples = Specify.new(@group_examples).process
172
198
 
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: rspec_html_formatter 0.3.0 ruby lib
5
+ # stub: rspec_html_formatter 0.3.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "rspec_html_formatter"
9
- s.version = "0.3.0"
9
+ s.version = "0.3.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Kingsley Hendrickse"]
14
- s.date = "2014-08-03"
14
+ s.date = "2014-09-25"
15
15
  s.description = "Rspec custom formatter to generate pretty html results"
16
16
  s.email = "kingsleyhendrickse@me.com"
17
17
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_html_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kingsley Hendrickse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-03 00:00:00.000000000 Z
11
+ date: 2014-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core