turnip_formatter 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  module TurnipFormatter
4
- VERSION = '0.3.3'
4
+ VERSION = '0.3.4'
5
5
  end
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec :path => '../..'
4
+ gem 'rspec', '~> 3.1.0'
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec :path => '../..'
4
+ gem 'rspec', '~> 3.2.0'
data/spec/spec_helper.rb CHANGED
@@ -8,7 +8,6 @@ SimpleCov.start do
8
8
  add_filter 'lib/turnip_formatter/ext'
9
9
  end
10
10
 
11
- require 'rspec-html-matchers'
12
11
  require 'turnip_formatter'
13
12
  Dir.glob(File.dirname(__FILE__) + '/support/**/*.rb') { |f| require(f) }
14
13
 
@@ -14,10 +14,10 @@ module TurnipFormatter::Printer
14
14
  }
15
15
  end
16
16
 
17
- describe '.print_out' do
18
- subject { Index.print_out(formatter) }
17
+ subject { Index.print_out(formatter) }
19
18
 
20
- it { should have_tag 'h1', text: 'Turnip Report' }
19
+ describe '.print_out' do
20
+ it { should match %r{<h1>Turnip Report</h1>} }
21
21
  end
22
22
 
23
23
  context 'project_name is changed' do
@@ -27,9 +27,7 @@ module TurnipFormatter::Printer
27
27
  end
28
28
 
29
29
  describe '.print_out' do
30
- subject { Index.print_out(formatter) }
31
-
32
- it { should have_tag 'h1', text: 'My Project Report' }
30
+ it { should match %r{<h1>My Project Report</h1>} }
33
31
  end
34
32
 
35
33
  after do
@@ -14,10 +14,10 @@ describe TurnipFormatter::Printer::Scenario do
14
14
  context 'with turnip example' do
15
15
  subject { described_class.print_out(scenario) }
16
16
 
17
- it { should have_tag 'a', with: { href: '#' + scenario.id } }
18
- it { should have_tag 'div.scenario-title', text: /Scenario: Scenario/ }
19
- it { should have_tag 'ul.tags' }
20
- it { should have_tag 'div.steps' }
17
+ it { should match %r{<a .*href="##{scenario.id}"} }
18
+ it { should match %r{<div class="scenario-title">.*Scenario: Scenario} }
19
+ it { should match %{<ul class="tags">} }
20
+ it { should match %{<div class="steps} }
21
21
  end
22
22
 
23
23
  context 'with no turnip example' do
@@ -15,18 +15,9 @@ module TurnipFormatter::Printer
15
15
 
16
16
  subject { StepExtraArgs.print_out([string]) }
17
17
 
18
- it {
19
- expect(subject).to have_tag 'table.step_outline' do
20
- with_tag 'tr:nth-child(1) td:nth-child(1)', text: /State/
21
- with_tag 'tr:nth-child(1) td:nth-child(2)', text: /Money/
22
-
23
- with_tag 'tr:nth-child(2) td:nth-child(1)', text: /<Tokushima>/
24
- with_tag 'tr:nth-child(2) td:nth-child(2)', text: /555/
25
-
26
- with_tag 'tr:nth-child(3) td:nth-child(1)', text: /<Okinawa>/
27
- with_tag 'tr:nth-child(3) td:nth-child(2)', text: /368/
28
- end
29
- }
18
+ it { should match %r{<td>State</td>[[:space:]]*<td>Money</td>} }
19
+ it { should match %r{<td>&lt;Tokushima&gt;</td>[[:space:]]*<td>555</td>} }
20
+ it { should match %r{<td>&lt;Okinawa&gt;</td>[[:space:]]*<td>368</td>} }
30
21
  end
31
22
  end
32
23
 
@@ -34,7 +25,7 @@ module TurnipFormatter::Printer
34
25
  describe '.print_out' do
35
26
  let(:string) { 'a<a>a' }
36
27
  subject { StepExtraArgs.print_out([string]) }
37
- it { should have_tag 'pre.multiline', text: 'a<a>a' }
28
+ it { should match %r{<pre class="multiline">a&lt;a&gt;a</pre>} }
38
29
  end
39
30
  end
40
31
  end
@@ -12,11 +12,10 @@ describe TurnipFormatter::Printer::Step do
12
12
  step
13
13
  end
14
14
 
15
- it do
16
- should have_tag 'div.step' do
17
- with_tag 'div.step-title'
18
- end
19
- end
15
+ it {
16
+ should match %r{<div class="step passed">}
17
+ should match %r{<div class="step-title">}
18
+ }
20
19
  end
21
20
 
22
21
  context 'has table argument' do
@@ -28,14 +27,10 @@ describe TurnipFormatter::Printer::Step do
28
27
  step
29
28
  end
30
29
 
31
- it do
32
- should have_tag 'div.step' do
33
- with_tag 'div.step-title'
34
- with_tag 'div.step-body' do
35
- with_tag 'table.step_outline'
36
- end
37
- end
38
- end
30
+ it {
31
+ should match %r{<div class="step-body">}
32
+ should match %r{<table class="step_outline">}
33
+ }
39
34
  end
40
35
 
41
36
  context 'has outline argument' do
@@ -43,14 +38,10 @@ describe TurnipFormatter::Printer::Step do
43
38
  passed_step
44
39
  end
45
40
 
46
- it do
47
- should have_tag 'div.step' do
48
- with_tag 'div.step-title'
49
- with_tag 'div.step-body' do
50
- with_tag 'table.multiline'
51
- end
52
- end
53
- end
41
+ it {
42
+ should match %r{<div class="step-body">}
43
+ should match %r{<pre class="multiline">}
44
+ }
54
45
  end
55
46
  end
56
47
  end
@@ -18,11 +18,19 @@ module TurnipFormatter::Printer
18
18
  html = statistics.print_out(passed_scenarios)
19
19
 
20
20
  passed_scenarios.sort { |a,b| a.run_time <=> b.run_time }.each.with_index(1) do |scenario, index|
21
- expect(html).to have_tag "tbody tr:nth-child(#{index})" do
22
- with_tag 'td:nth-child(1) span', text: scenario.feature_name
23
- with_tag "td:nth-child(2) a[href='\##{scenario.id}']", text: scenario.name
24
- with_tag 'td:nth-child(3) span', text: /#{scenario.run_time}/
25
- end
21
+ tag_feature_name = "<span>#{scenario.feature_name}</span>"
22
+ tag_scenario_name = "<a href=\"\##{scenario.id}\">#{scenario.name}</a>"
23
+ tag_run_time = "<span>#{scenario.run_time} sec</span>"
24
+
25
+ expect_match = [
26
+ '<tr>',
27
+ "<td>#{tag_feature_name}</td>",
28
+ "<td>#{tag_scenario_name}</td>",
29
+ "<td>#{tag_run_time}</td>",
30
+ '</tr>'
31
+ ].join
32
+
33
+ expect(html).to match %r(#{expect_match})
26
34
  end
27
35
  end
28
36
  end
@@ -13,22 +13,13 @@ describe TurnipFormatter::StepTemplate::Exception do
13
13
  describe '#build_failed' do
14
14
  subject { template.build_failed(failed_example) }
15
15
 
16
- it do
17
- expect(subject).to have_tag 'div.step_exception' do
18
- with_tag 'pre'
19
- with_tag 'ol > li'
20
- end
21
- end
16
+ it { should match %r{<div class="step_exception">} }
22
17
  end
23
18
 
24
19
  describe '#build_pending' do
25
20
  subject { template.build_pending(pending_example) }
26
21
 
27
- it do
28
- expect(subject).to have_tag 'div.step_exception' do
29
- with_tag 'pre', text: 'No such step(0): '
30
- with_tag 'ol > li'
31
- end
32
- end
22
+ it { should match %r{<div class="step_exception">} }
23
+ it { should match %r{<pre>No such step} }
33
24
  end
34
25
  end
@@ -10,9 +10,9 @@ describe TurnipFormatter::StepTemplate::Source do
10
10
  subject { template.build(failed_example) }
11
11
 
12
12
  it do
13
- expect(subject).to have_tag 'pre.source > code.ruby' do
14
- with_tag 'span.linenum'
15
- end
13
+ should match %r{<pre class="source">}
14
+ should match %r{<code class="ruby">}
15
+ should match %r{<span class="linenum">}
16
16
  end
17
17
  end
18
18
  end
@@ -65,7 +65,7 @@ describe TurnipFormatter::Template do
65
65
  end
66
66
 
67
67
  context 'add incorrect uri' do
68
- let(:path) { 'http://e_xample.com/foo.js' }
68
+ let(:path) { 'http://e xample.com/foo.js' }
69
69
  it { should be_empty }
70
70
  end
71
71
  end
@@ -111,7 +111,7 @@ describe TurnipFormatter::Template do
111
111
  end
112
112
 
113
113
  context 'add incorrect uri' do
114
- let(:path) { 'http://e_xample.com/foo.css' }
114
+ let(:path) { 'http://e xample.com/foo.css' }
115
115
  it { should be_empty }
116
116
  end
117
117
  end
@@ -18,12 +18,11 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^spec/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency 'turnip', '~> 1.2.4'
21
+ spec.add_dependency 'turnip', '~> 1.3.0'
22
22
  spec.add_dependency 'slim'
23
23
  spec.add_dependency 'rspec', ['>=2.14.0', '<4.0']
24
24
  spec.add_development_dependency 'bundler', '~> 1.3'
25
25
  spec.add_development_dependency 'rake'
26
- spec.add_development_dependency 'rspec-html-matchers'
27
26
  spec.add_development_dependency 'coveralls'
28
27
  spec.add_development_dependency 'guard-rspec'
29
28
  spec.add_development_dependency 'sass'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turnip_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wataru MIYAGUNI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-16 00:00:00.000000000 Z
11
+ date: 2015-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: turnip
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.4
19
+ version: 1.3.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.2.4
26
+ version: 1.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: slim
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -86,20 +86,6 @@ dependencies:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
- - !ruby/object:Gem::Dependency
90
- name: rspec-html-matchers
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- version: '0'
96
- type: :development
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: '0'
103
89
  - !ruby/object:Gem::Dependency
104
90
  name: coveralls
105
91
  requirement: !ruby/object:Gem::Requirement
@@ -231,6 +217,8 @@ files:
231
217
  - spec/gemfiles/Gemfile-rspec-2.14.x
232
218
  - spec/gemfiles/Gemfile-rspec-2.99.x
233
219
  - spec/gemfiles/Gemfile-rspec-3.0.x
220
+ - spec/gemfiles/Gemfile-rspec-3.1.x
221
+ - spec/gemfiles/Gemfile-rspec-3.2.x
234
222
  - spec/spec_helper.rb
235
223
  - spec/support/example_helper.rb
236
224
  - spec/support/passed.feature
@@ -278,6 +266,8 @@ test_files:
278
266
  - spec/gemfiles/Gemfile-rspec-2.14.x
279
267
  - spec/gemfiles/Gemfile-rspec-2.99.x
280
268
  - spec/gemfiles/Gemfile-rspec-3.0.x
269
+ - spec/gemfiles/Gemfile-rspec-3.1.x
270
+ - spec/gemfiles/Gemfile-rspec-3.2.x
281
271
  - spec/spec_helper.rb
282
272
  - spec/support/example_helper.rb
283
273
  - spec/support/passed.feature