jahtml_formatter 1.0.1 → 1.0.2
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/jahtml_formatter.gemspec +1 -1
- data/lib/iso_example_group_methods.rb +8 -1
- data/lib/iso_example_methods.rb +14 -0
- data/lib/jahtml_formatter.rb +5 -0
- metadata +3 -2
data/jahtml_formatter.gemspec
CHANGED
@@ -4,9 +4,16 @@ module IsoExampleGroupMethods
|
|
4
4
|
klass.extend ClassMethods
|
5
5
|
end
|
6
6
|
module ClassMethods
|
7
|
+
## why so ugly? - this basically says
|
8
|
+
## that the same iso_id can only appear ONCE
|
9
|
+
## that may or may not be correct
|
10
|
+
@@__defined_iso_tags = Hash.new
|
7
11
|
def description
|
8
12
|
if iso_id = metadata.delete(:iso_id)
|
9
|
-
|
13
|
+
unless @@__defined_iso_tags.key?(iso_id)
|
14
|
+
metadata[:example_group][:description] = "#{metadata[:example_group][:description]}, iso: #{iso_id}"
|
15
|
+
@@__defined_iso_tags[iso_id] = true
|
16
|
+
end
|
10
17
|
end
|
11
18
|
super
|
12
19
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# coding: UTF-8
|
2
|
+
module IsoExampleMethods
|
3
|
+
def description
|
4
|
+
if @options.key?(:iso_id)
|
5
|
+
## if the description is empty... we don't do anything
|
6
|
+
## I guess it can be empty if an it is defined like so:
|
7
|
+
## it { should have(5).items } - what then?
|
8
|
+
unless metadata[:description].to_s.empty? || metadata[:description].include?(@options[:iso_id])
|
9
|
+
metadata[:description] = "#{metadata[:description]}, iso: #{@options[:iso_id]}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
super
|
13
|
+
end
|
14
|
+
end
|
data/lib/jahtml_formatter.rb
CHANGED
@@ -2,6 +2,8 @@ require 'erb'
|
|
2
2
|
require 'rspec/core/formatters/html_formatter'
|
3
3
|
require 'jahtml_printer'
|
4
4
|
require 'iso_example_group_methods'
|
5
|
+
require 'iso_example_methods'
|
6
|
+
require 'rspec/core'
|
5
7
|
|
6
8
|
class JahtmlFormatter < RSpec::Core::Formatters::HtmlFormatter
|
7
9
|
def initialize(output)
|
@@ -12,4 +14,7 @@ end
|
|
12
14
|
|
13
15
|
RSpec.configure do |config|
|
14
16
|
config.include IsoExampleGroupMethods
|
17
|
+
config.before do
|
18
|
+
example.extend IsoExampleMethods
|
19
|
+
end
|
15
20
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jahtml_formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- README.md
|
43
43
|
- jahtml_formatter.gemspec
|
44
44
|
- lib/iso_example_group_methods.rb
|
45
|
+
- lib/iso_example_methods.rb
|
45
46
|
- lib/jahtml_formatter.rb
|
46
47
|
- lib/jahtml_printer.rb
|
47
48
|
homepage: https://github.com/eimermusic/jahtml_formatter
|