turnip_formatter 0.2.6 → 0.2.7

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.
@@ -1,6 +1,7 @@
1
1
  require 'turnip_formatter'
2
2
 
3
3
  RSpec.configure do |config|
4
+ config.project_name = "My project"
4
5
  config.add_formatter RSpecTurnipFormatter, 'report.html'
5
6
  end
6
7
 
@@ -2,7 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
- <title>turnip formatter report</title>
5
+ <title><%= TurnipFormatter::Template.project_name %> report</title>
6
6
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
7
7
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
8
8
  <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.9.1/jquery.tablesorter.min.js"></script>
@@ -13,7 +13,7 @@
13
13
  </head>
14
14
  <body>
15
15
  <div id="report">
16
- <h1>Turnip Report</h1>
16
+ <h1><%= TurnipFormatter::Template.project_name %> Report</h1>
17
17
  <section class="checkbox">
18
18
  <label for="passed_check">Passed</label><input type="checkbox" id="passed_check">
19
19
  <label for="failed_check">Failed</label><input type="checkbox" checked id="failed_check">
@@ -42,6 +42,7 @@ $gray-background: #DDDDDD;
42
42
  }
43
43
 
44
44
  body {
45
+ margin: 0;
45
46
  background-color: #ffffff;
46
47
  }
47
48
 
@@ -161,7 +162,7 @@ div#steps-statistics section.scenario {
161
162
  table.step_outline {
162
163
  margin-top: 2em;
163
164
 
164
- tr:nth-child(odd) {
165
+ tr:nth-child(odd) {
165
166
  background-color: #ddddcc;
166
167
  }
167
168
 
@@ -195,7 +196,7 @@ div#tag-statistics {
195
196
  table {
196
197
  width: 100%;
197
198
  margin: 1em 0em;
198
-
199
+
199
200
  thead {
200
201
  th {
201
202
  border-bottom: 1px solid $gray-front;
@@ -203,7 +204,7 @@ div#tag-statistics {
203
204
  }
204
205
 
205
206
  tbody {
206
- tr:nth-child(odd) {
207
+ tr:nth-child(odd) {
207
208
  background-color: #FFFFFF;
208
209
  }
209
210
 
@@ -6,6 +6,10 @@ require 'sass'
6
6
  module TurnipFormatter
7
7
  class Template
8
8
  class << self
9
+ def project_name
10
+ RSpec.configuration.respond_to?(:project_name) ? RSpec.configuration.project_name : 'Turnip'
11
+ end
12
+
9
13
  def add_js(js_string)
10
14
  js_list << js_string
11
15
  end
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  module TurnipFormatter
4
- VERSION = "0.2.6"
4
+ VERSION = "0.2.7"
5
5
  end
@@ -13,3 +13,7 @@ module TurnipFormatter
13
13
  end
14
14
 
15
15
  RSpecTurnipFormatter = RSpec::Core::Formatters::TurnipFormatter
16
+
17
+ RSpec.configure do |config|
18
+ config.add_setting :project_name, :default => "Turnip"
19
+ end
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+ require 'turnip_formatter/printer/index'
3
+
4
+ module TurnipFormatter::Printer
5
+ describe Index do
6
+
7
+ let(:formatter) do
8
+ double("Formatter", {
9
+ :scenarios => [],
10
+ :passed_scenarios => [],
11
+ :failure_count => 0,
12
+ :pending_count => 0,
13
+ :duration => 0
14
+ })
15
+ end
16
+
17
+ describe '.print_out' do
18
+ subject { Index.print_out(formatter) }
19
+
20
+ it { should have_tag 'h1', text: 'Turnip Report' }
21
+ end
22
+
23
+ context 'project_name is changed' do
24
+ before do
25
+ @original_project_name = RSpec.configuration.project_name
26
+ RSpec.configuration.project_name = 'My Project'
27
+ end
28
+
29
+ describe '.print_out' do
30
+ subject { Index.print_out(formatter) }
31
+
32
+ it { should have_tag 'h1', text: 'My Project Report' }
33
+ end
34
+
35
+ after do
36
+ RSpec.configuration.project_name = @original_project_name
37
+ end
38
+ end
39
+ end
40
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turnip_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
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: 2013-10-15 00:00:00.000000000 Z
12
+ date: 2013-10-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: turnip
@@ -204,6 +204,7 @@ files:
204
204
  - spec/spec_helper.rb
205
205
  - spec/support/passed.feature
206
206
  - spec/support/shared_context_examples.rb
207
+ - spec/turnip_formatter/printer/index_spec.rb
207
208
  - spec/turnip_formatter/printer/scenario_spec.rb
208
209
  - spec/turnip_formatter/printer/step_extra_args_spec.rb
209
210
  - spec/turnip_formatter/printer/step_spec.rb
@@ -235,7 +236,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
235
236
  version: '0'
236
237
  segments:
237
238
  - 0
238
- hash: -3227762522370957766
239
+ hash: -3850728924246134423
239
240
  required_rubygems_version: !ruby/object:Gem::Requirement
240
241
  none: false
241
242
  requirements:
@@ -244,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
245
  version: '0'
245
246
  segments:
246
247
  - 0
247
- hash: -3227762522370957766
248
+ hash: -3850728924246134423
248
249
  requirements: []
249
250
  rubyforge_project:
250
251
  rubygems_version: 1.8.23
@@ -256,6 +257,7 @@ test_files:
256
257
  - spec/spec_helper.rb
257
258
  - spec/support/passed.feature
258
259
  - spec/support/shared_context_examples.rb
260
+ - spec/turnip_formatter/printer/index_spec.rb
259
261
  - spec/turnip_formatter/printer/scenario_spec.rb
260
262
  - spec/turnip_formatter/printer/step_extra_args_spec.rb
261
263
  - spec/turnip_formatter/printer/step_spec.rb