cucumber-in-the-yard 1.7.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ === 1.7.1 / 2010-11-28
2
+
3
+ * Feature file with layout enhancements
4
+ * Scenarios are now linked/linkable
5
+ * FIX Scenario Outline error on CentOS, Ruby 1.8.7
6
+ * FIX Requiring Cucumber before Gherkin so that correct gherkin is loaded
7
+
1
8
  === 1.7.0 / 2010-11-18
2
9
 
3
10
  * Dynamic Tag Union / Intersection
@@ -39,9 +39,11 @@ Feature: Scenario
39
39
  Oh what a bother!
40
40
  """
41
41
 
42
+ # Comments before the scenario
42
43
  @seventh @comments
43
- Scenario: Scenario with comments and
44
- with multiple lines for the name
44
+ Scenario: Scenario with comments and a description
45
+ There once was a need for information to be displayed alongside all the
46
+ entities that I hoped to test
45
47
  # First Comment
46
48
  Given this first step
47
49
  # Second Comment
data/lib/city.rb CHANGED
@@ -1,13 +1,11 @@
1
- require 'gherkin/rubify'
2
1
  require 'cucumber/parser/gherkin_builder'
3
2
  require 'gherkin/parser/parser'
4
3
  require 'gherkin/formatter/tag_count_formatter'
5
4
 
6
5
  module CucumberInTheYARD
7
- VERSION = '1.7.0' unless defined?(CucumberInTheYARD::VERSION)
6
+ VERSION = '1.7.1' unless defined?(CucumberInTheYARD::VERSION)
8
7
  end
9
8
 
10
-
11
9
  require File.dirname(__FILE__) + "/yard/code_objects/cucumber/base.rb"
12
10
  require File.dirname(__FILE__) + "/yard/code_objects/cucumber/namespace_object.rb"
13
11
  require File.dirname(__FILE__) + "/yard/code_objects/cucumber/feature.rb"
@@ -34,7 +34,8 @@ module Cucumber
34
34
  end
35
35
 
36
36
  def feature(feature)
37
- #log.debug "FEATURE: #{feature.name} #{feature.line} #{feature.keyword} #{feature.description}"
37
+ #log.debug "FEATURE"
38
+
38
39
  @feature = YARD::CodeObjects::Cucumber::Feature.new(@namespace,File.basename(@file.gsub('.feature','').gsub('.','_'))) do |f|
39
40
  f.comments = feature.comments.map{|comment| comment.value}.join("\n")
40
41
  f.description = feature.description
@@ -48,7 +49,8 @@ module Cucumber
48
49
  end
49
50
 
50
51
  def background(background)
51
- #log.debug "BACKGROUND #{background.keyword} #{background.name} #{background.line} #{background.description}"
52
+ #log.debug "BACKGROUND"
53
+
52
54
  @background = YARD::CodeObjects::Cucumber::Scenario.new(@feature,"background") do |b|
53
55
  b.comments = background.comments.map{|comment| comment.value}.join("\n")
54
56
  b.description = background.description
@@ -64,6 +66,7 @@ module Cucumber
64
66
 
65
67
  def scenario(statement)
66
68
  #log.debug "SCENARIO"
69
+
67
70
  scenario = YARD::CodeObjects::Cucumber::Scenario.new(@feature,"scenario_#{@feature.scenarios.length + 1}") do |s|
68
71
  s.comments = statement.comments.map{|comment| comment.value}.join("\n")
69
72
  s.description = statement.description
@@ -81,7 +84,7 @@ module Cucumber
81
84
 
82
85
  def scenario_outline(statement)
83
86
  #log.debug "SCENARIO OUTLINE"
84
-
87
+
85
88
  outline = YARD::CodeObjects::Cucumber::ScenarioOutline.new(@feature,"scenario_#{@feature.scenarios.length + 1}") do |s|
86
89
  s.comments = statement.comments.map{|comment| comment.value}.join("\n")
87
90
  s.description = statement.description
@@ -116,8 +119,6 @@ module Cucumber
116
119
  s.add_file(@file,@step_container.line_number)
117
120
  s.keyword = @step_container.keyword
118
121
  s.value = "#{@step_container.value} (#{@step_container.scenarios.length + 1})"
119
-
120
- #TODO: Should scenario instances have their own tag instances?
121
122
  end
122
123
 
123
124
  @step_container.steps.each do |step|
@@ -151,13 +152,16 @@ module Cucumber
151
152
  end
152
153
 
153
154
  def step(step)
154
- #log.debug "STEP #{step.multiline_arg}"
155
+ #log.debug "STEP"
156
+
155
157
  @table_owner = YARD::CodeObjects::Cucumber::Step.new(@step_container,"#{step.line}") do |s|
156
158
  s.keyword = step.keyword
157
159
  s.value = step.name
158
160
  s.add_file(@file,step.line)
159
161
  end
160
162
 
163
+ @table_owner.comments = step.comments.map{|comment| comment.value}.join("\n")
164
+
161
165
  multiline_arg = rubify(step.multiline_arg)
162
166
 
163
167
  case(multiline_arg)
@@ -1,22 +1,32 @@
1
+ <script type="text/javascript" charset="utf-8">
2
+ $(function() {
3
+ $(".developer").hide();
4
+ });
5
+ </script>
6
+
1
7
  <div class="feature">
2
- <div class="title">
3
- <span class="pre"><%= @feature.keyword %>:</span>
4
- <span class="name"><%= @feature.value %></span>
5
- </div>
8
+ <div class="title">
9
+ <span class="pre"><%= @feature.keyword %>:</span>
10
+ <span class="name"><%= @feature.value %></span>
6
11
 
7
- <div class="meta">
8
- <div class="file"><%= h(@feature.file) %></div>
9
- <div class="tags">
10
- <% @feature.tags.each do |tag| %>
11
- <a href="<%= url_for tag %>"><%= tag.value %></a>
12
- <% end %>
13
- </div>
14
- </div>
12
+ <div id="view">[More Detail]</div>
13
+ <div id="expand">[Collapse All]</div>
14
+ </div>
15
15
 
16
- <div class="description">
17
- <%= @feature.description %>
18
- </div>
16
+ <div class="meta">
17
+ <div class="file developer"><%= h(@feature.file) %></div>
18
+ <div style="clear: right;"></div>
19
+ <div class="tags developer">
20
+ <% @feature.tags.each do |tag| %>
21
+ <a href="<%= url_for tag %>"><%= tag.value %></a>
22
+ <% end %>
23
+ </div>
24
+ </div>
25
+
26
+ <div class="description">
27
+ <%= @feature.description %>
28
+ </div>
19
29
 
20
- <%= yieldall %>
30
+ <%= yieldall %>
21
31
  </div>
22
32
 
@@ -1 +1 @@
1
- <span class="none">No Steps Defined</span>
1
+ <div class="none">No Steps Defined</div>
@@ -1,56 +1,25 @@
1
1
  <% @scenario.scenarios.each_with_index do |scenario,example_index| %>
2
- <div id="<%= "#{@id}Example#{example_index + 1}Steps" %>" style="display: none;" class="steps">
3
- <% scenario.steps.each_with_index do |step,index| %>
4
- <% @step = step %>
5
-
6
-
7
- <div <%= "id='#{@id}Example#{example_index + 1}Step#{index}'" %> class="step <%= (index + 1) % 2 == 0 ? 'even' : 'odd' %>">
8
- <span class="predicate"><%= step.keyword %></span>
9
-
10
- <% if step.definition %>
11
- <span class="defined">
12
- <%= highlight_matches(step) %>
13
- <div class="details">
14
- <a href="<%= url_for step.definition %>"><div class="valid">&nbsp;</div></a>
15
- </div>
16
- </span>
17
- <% else %>
18
- <span class="undefined">
19
- <%= h step.value %>
20
- <div class="details">
21
- <a href="<%= url_for YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE %>#undefined_steps">
22
- <div class="invalid">&nbsp;</div>
23
- </a>
24
- </div>
25
- </span>
26
- <% end %>
27
-
2
+ <div style="display: none;" class="steps <%= "example#{example_index + 1}" %>">
3
+ <% @scenario_outline = @scenario ; @scenario = scenario ; @steps = scenario.steps %>
4
+ <%= erb(:steps) %>
5
+ <% @scenario = @scenario_outline %>
28
6
  </div>
29
-
30
- <%= erb(:table) if step.has_table? %>
31
- <%= erb(:pystring) if step.has_text? %>
32
-
33
-
34
- <% end %>
35
- </div>
36
7
  <% end %>
37
8
 
38
-
39
9
  <div class="outline">
40
10
  <div class="keyword"> <%= h @scenario.example_keyword %> </div>
41
11
  <table>
42
12
  <thead>
43
13
  <tr>
44
14
  <% @scenario.example_headers.each_with_index do |header,header_index| %>
45
- <th><%= h(header) %></th>
15
+ <th><%= h(header) %></th>
46
16
  <% end %>
47
17
  </tr>
48
18
  </thead>
49
19
  <% @scenario.example_data.each_with_index do |row,row_index| %>
50
- <tr class="<%= (row_index + 1) % 2 == 0 ? 'even' : 'odd' %>"
51
- onclick="<%= "toggleScenarioExample('#{@id}',#{row_index + 1});" %>">
20
+ <tr class="<%= (row_index + 1) % 2 == 0 ? "even example#{row_index +1}" : "odd example#{row_index +1}" %>">
52
21
  <% row.each_with_index do |column,column_index| %>
53
- <td><%= h(column.to_s.strip) %></td>
22
+ <td><%= h(column.to_s.strip) %></td>
54
23
  <% end %>
55
24
  </tr>
56
25
  <% end %>
@@ -1,41 +1,52 @@
1
- <script type="text/javascript" charset="utf-8">
2
- $(function() {
3
- $('#<%= @id %> .toggle').click(function() {
4
- $("#<%= @id %>Steps").toggle('blind');
5
-
6
- var stateIndicator = $('#<%= @id %> a.toggle')[0]
7
-
8
- stateIndicator.innerHTML = (stateIndicator.innerHTML === '+' ? '-' : '+');
9
- return false;
10
- });
11
- });
12
- </script>
13
-
14
- <div id="<%= @id %>" class="scenario">
15
- <div class="title">
16
- <a class="toggle">-</a>
17
- <span class="pre"><%= @scenario.keyword %>:</span>
18
- <span class="name"><%= h @scenario.value %></span>
19
- </div>
20
- <div class="meta">
21
- <div class="file"><%= @scenario.location %></div>
22
- <% unless @scenario.tags.empty? %>
23
- <div class="tags">
24
- <% @scenario.tags.each do |tag| %>
25
- <a href="<%= url_for tag %>"><%= tag.value %></a>
26
- <% end %>
27
- </div>
28
- <% end%>
29
- </div>
30
- <% unless @scenario.description.empty? %>
31
- <div class="description">
32
- <%= h @scenario.description %>
33
- </div>
34
- <% end %>
35
-
36
- <div id="<%= @id %>Steps" class="steps">
37
- <%= @scenario.steps.empty? ? erb(:no_steps_defined) : erb(:steps) %>
1
+ <div class="scenario">
2
+ <a name="<%= @id %>" />
3
+ <div class="title">
4
+ <a class="toggle">&nbsp;-&nbsp;</a>
5
+ <span class="pre"><%= @scenario.keyword %>:</span>
6
+ <span class="name"><%= h @scenario.value %></span>
7
+ </div>
8
+
9
+ <% if @scenario.description.length > 0 %>
10
+ <div class="description">
11
+ <%= h @scenario.description %>
12
+ </div>
13
+ <% end %>
14
+
15
+ <% if @scenario.comments.length > 0 %>
16
+ <div class="comments developer">
17
+ <%= h @scenario.comments %>
18
+ </div>
19
+ <% end %>
20
+
21
+ <div class="details">
22
+ <div class="meta developer">
23
+ <div class="file"><%= @scenario.location %></div>
24
+ <% unless @scenario.tags.empty? %>
25
+ <div style="clear:right;"></div>
26
+ <div class="tags">
27
+ <% @scenario.tags.each do |tag| %>
28
+ <a href="<%= url_for tag %>"><%= tag.value %></a>
29
+ <% end %>
38
30
  </div>
31
+ <% end%>
32
+ <div style="clear: both;"></div>
33
+ </div>
34
+
35
+ <div class="steps">
36
+ <% if @scenario.steps.empty? %>
37
+ <%= erb(:no_steps_defined) %>
38
+ <% else %>
39
+ <%= @steps = @scenario.steps ; erb(:steps) %>
40
+ <% end %>
41
+ </div>
42
+
43
+
44
+ <%= erb(:outline) if @scenario.outline? %>
45
+
46
+ </div>
39
47
 
40
- <%= erb(:outline) if @scenario.outline? %>
48
+ <div class="attributes" style="display:none;">
49
+ <input type="hidden" name="collapsed" value="false">
50
+ </div>
51
+
41
52
  </div>
@@ -1,31 +1,33 @@
1
- <% @scenario.steps.each_with_index do |step,index| %>
1
+ <% @steps.each_with_index do |step,index| %>
2
2
  <% @step = step %>
3
3
 
4
-
5
- <div <%= "id='#{@id}Step#{index}'" %> class="step <%= (index + 1) % 2 == 0 ? 'even' : 'odd' %>">
4
+ <% if step.comments && step.comments.length > 0 %>
5
+ <div class="comments developer"><%= h step.comments %></div>
6
+ <% end %>
7
+ <div class="step <%= (index + 1) % 2 == 0 ? 'even' : 'odd' %>">
6
8
  <span class="predicate"><%= step.keyword %></span>
7
9
 
8
10
  <% if @scenario.outline? %>
9
- <%= step.value %>
11
+ <%= h step.value %>
10
12
  <% else %>
11
13
 
12
- <% if step.definition %>
13
- <span class="defined">
14
- <%= highlight_matches(step) %>
15
- <div class="details">
16
- <a href="<%= url_for step.definition %>"><div class="valid">&nbsp;</div></a>
17
- </div>
18
- </span>
19
- <% else %>
20
- <span class="undefined">
21
- <%= h step.value %>
22
- <div class="details">
23
- <a href="<%= url_for YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE %>#undefined_steps">
24
- <div class="invalid">&nbsp;</div>
25
- </a>
26
- </div>
27
- </span>
28
- <% end %>
14
+ <% if step.definition %>
15
+ <span class="defined">
16
+ <%= highlight_matches(step) %>
17
+ <div class="definition developer">
18
+ <a href="<%= url_for step.definition %>"><div class="valid">&nbsp;</div></a>
19
+ </div>
20
+ </span>
21
+ <% else %>
22
+ <span class="undefined">
23
+ <%= h step.value %>
24
+ <div class="definition developer">
25
+ <a href="<%= url_for YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE %>#undefined_steps">
26
+ <div class="invalid">&nbsp;</div>
27
+ </a>
28
+ </div>
29
+ </span>
30
+ <% end %>
29
31
 
30
32
  <% end %>
31
33
  </div>
@@ -34,4 +36,4 @@
34
36
  <%= erb(:pystring) if step.has_text? %>
35
37
 
36
38
 
37
- <% end %>
39
+ <% end %>
@@ -4,7 +4,6 @@ def init
4
4
 
5
5
  sections.push :feature
6
6
 
7
- sections.push :background if object.background
8
7
  sections.push :scenarios if object.scenarios
9
8
 
10
9
  end
@@ -18,6 +17,12 @@ end
18
17
  def scenarios
19
18
  scenarios = ""
20
19
 
20
+ if @feature.background
21
+ @scenario = @feature.background
22
+ @id = "background"
23
+ scenarios += erb(:scenario)
24
+ end
25
+
21
26
  @feature.scenarios.each_with_index do |scenario,index|
22
27
  @scenario = scenario
23
28
  @id = "scenario#{index}"
@@ -77,7 +77,11 @@
77
77
  <% n = 1 %>
78
78
  <% scenarios.each_with_index do |scenario,index| %>
79
79
  <li class="scenario r<%= n %> <%= scenario.tags.collect{|t| t.value }.join(" ") %>">
80
- <%= linkify scenario.feature, scenario.value %>
80
+ <span class='object_link'>
81
+ <a href="<%= url_for(scenario.feature,"scenario#{scenario.feature.scenarios.index(scenario) }") %>">
82
+ <%= h scenario.value %>
83
+ </a>
84
+ </span>
81
85
  <% itags = scenario.tags.collect{|t| tagify(t) }.join(", ") %>
82
86
  <% if itags && itags != "" %>
83
87
  - <small><%= itags %></small>
@@ -25,7 +25,7 @@ def features
25
25
  end
26
26
 
27
27
  def scenarios
28
- @scenarios ||= Registry.all(:scenario).reject {|s| s.outline? || s.background? }.sort {|x,y| x.value <=> y.value }
28
+ @scenarios ||= features.collect {|f| f.scenarios.reject {|s| s.background? } }.flatten.sort {|x,y| x.value <=> y.value }
29
29
  end
30
30
 
31
31
  def tagify(tag)
@@ -4,15 +4,19 @@
4
4
  .tags { font-family: monospace; font-size: 14px; }
5
5
  .title { padding: 10px; font-size: 24px; }
6
6
 
7
+ #view, #expand { float: right; font-size: 13px; color: gray; vertical-align: bottom; }
8
+
7
9
  .feature > .title, .tag > .title, .requirements > .title { margin: 20px 20px 10px 20px; padding-left: 0px; border-bottom: 1px solid #E3E3E3; }
8
- .meta .file { float: right; margin-right: 20px; }
9
- .title .pre { color: #696969; }
10
+ .meta .file { float: right; margin-top: 5px; margin-right: 20px; }
11
+ .title .pre { color: #696969; }
10
12
  .title .name { font-weight: bold; color: #3F3F3F; }
11
13
 
12
14
  .meta { margin-left: 30px; color: gray; }
13
15
  .scenario .meta .tags { margin-left: 0px; }
16
+ .feature .meta .tags { float: right; margin-right: 20px; }
17
+
14
18
 
15
- .feature .description, .requirements .summary, .scenario .description, #background .description {
19
+ .feature .description, .requirements .summary {
16
20
  margin: 10px 20px 0px 30px;
17
21
  padding: 10px 20px 20px 10px;
18
22
  color: #343332;
@@ -20,13 +24,15 @@
20
24
  }
21
25
 
22
26
  .summary .name, .tags .name { color: gray; }
23
- .summary .tags {}
24
27
 
25
28
  .odd { background-color: #F0F6F9; }
26
29
  .even { background-color: #FFFFFF; }
30
+ .selected { background-color: #FFCC80; }
31
+
27
32
 
28
33
  #background, #features, #scenarios { margin-top: 10px; margin-left: 20px; }
29
34
 
35
+
30
36
  #directory { margin-top: 20px; margin-left: 20px; }
31
37
 
32
38
  .scenario { margin-top: 40px; margin-left: 20px; }
@@ -44,6 +50,8 @@
44
50
 
45
51
  #background .title .pre { color: #346F97; }
46
52
  .requirements .tags { margin-left: 50px; margin-right: 30px; }
53
+ .scenario .tags { float: right; margin-right: 20px; margin-top: 5px; }
54
+
47
55
 
48
56
  * ul.alpha { font-size: 1.1em; }
49
57
  * ul.alpha { padding-bottom: 10px; list-style: none; }
@@ -53,7 +61,7 @@
53
61
 
54
62
 
55
63
  .scenario .steps, #background .steps {
56
- margin: 20px 20px 0px 30px;
64
+ margin: 0px 20px 0px 30px;
57
65
  font-size: 12px;
58
66
  }
59
67
 
@@ -67,18 +75,25 @@
67
75
 
68
76
 
69
77
  #background .title .name {}
70
- #background .description {}
71
78
 
72
79
  .scenario .title .name {}
73
- .scenario .description { }
80
+
81
+ #background .description, .scenario .description {
82
+ padding: 10px;
83
+ color: #444444;
84
+ margin-right: 20px;
85
+ margin-left: 20px;
86
+ }
87
+
88
+ .comments { margin-left: 25px; color: gray; padding: 5px; font-size: 13px; }
89
+ .scenario .steps .comments { margin-left: 0px; }
74
90
 
75
91
  .scenario .title .pre { color: #00AAD2; }
76
- .scenario .tags { margin-left: 30px; margin-top: 10px; }
77
92
 
78
93
  .step .predicate { color: #5D5C5B; }
79
94
  /*.step .undefined { border-bottom: 1px dashed #E99494; }*/
80
95
  .step .defined {}
81
- .step .details { float: right; color: #343332; }
96
+ .step .definition { float: right; color: #343332; }
82
97
  .step .details .pre {}
83
98
  .step .details .name { font-family: monospace; color: black; }
84
99
  .step .defined .match { color: #346F97; }
@@ -101,6 +116,7 @@
101
116
  font-size: 16px;
102
117
  }
103
118
 
119
+
104
120
  .multiline table tr, .outline table tr {
105
121
  padding: 4px;
106
122
  }
@@ -168,7 +184,6 @@
168
184
  }
169
185
 
170
186
  .valid {
171
- margin: 0px auto 10px auto;
172
187
  width: 15px;
173
188
  height: 15px;
174
189
  background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAIAAAC0tAIdAAAACXBIWXMAAA86AAAPOgGXOdvCAAABVklEQVQoFS2RO1IEMQxEJY+zzSDZlCNwAQIOxJm4DReAnICIIuFTW7U7lsxreTUzHltqtVqyPzw/HQ+3Oaebpc16EospszJ+OfP7/NePh5vHu/sRMfHw2RwxLjHOcQnlJHg42L9+vncIImOPQTbQOXPPHBmRE3o5RQMZwexmvig5pxFTMkqoLllaSZa/5ewgAoA4QEgrgXqXc9ELvbs1iItVNMCh4RgW1GzWoAaHEXV3lJjzwFeiqXD1OAjXUrjmzMw70MbrqFI5WBaTUKUbnDcW4TUTpIugcmBjg5wliRblb0gSoMO1ApxKkWrzXadmtrl6K98UN/takaLJMEGmFMtHmtMRHXCma8kXWd0cN5L7HHtdPIIJ1fAlFevcDcrFJ2JmPFYdVimTJOnQFZq45S9Xeb1tbettU6+a9WqnemLeX6ffl483BcjFdN01eyFFVHK0/FxO/9H/ezlUKYH7AAAAAElFTkSuQmCC) no-repeat center;
@@ -176,7 +191,6 @@
176
191
  }
177
192
 
178
193
  .invalid {
179
- margin: 0px auto 10px auto;
180
194
  width: 15px;
181
195
  height: 15px;
182
196
  background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAIAAAC0tAIdAAAACXBIWXMAAA86AAAPOgGXOdvCAAABWUlEQVQoFS2SvVEEMQyFJdkspFcCVAAVUREZXVAHHRAwZOQwQ3YM67X4nnwe3+3afn+S18/P9366s5yZ042R6c3c3bRKDw+WwZxf791Pt/3hMcev5QBpFtauPLoBYrYr6zcem/Xr8frUbc4c59zPPoekQeSesTm47IaD74kfTjnDbNqxC5pTzrJfQcCFBQClIh7bIdDc9S+6E8WIQXTl9somfA1S4iJVbUnJmyOhJT+51AMRkXVArMtBdUNLGcpmaReDdSIGHw4m2iyNIiMslTWqBvMuZSVZB4QhMRRp6IUjzYuPctvq3TpWumq2sIfNw/KQ3DwomfIv6aVBT+ZQMFKxhB8uLfhlzkO3Sstlwh1ja3+oEKVuqipGHhMztEGvvlZEQHwyMKPD1NDtrrpBR3jbalv90hWzo05FBr1vlKGXtvGF9fz5HG8vFRpK1a5yV0/KVuZSzO+Pf3G6tVs/+L00AAAAAElFTkSuQmCC) no-repeat center;
@@ -12,10 +12,14 @@
12
12
  <% n = n == 2 ? 1 : 2 %>
13
13
  <% if feature.scenarios %>
14
14
  <ul>
15
- <% feature.scenarios.each do |scenario| %>
15
+ <% feature.scenarios.each_with_index do |scenario,index| %>
16
16
  <li class="r<%= n %>">
17
- <%= linkify feature, scenario.value %>
18
- <small><%= scenario.location %></small>
17
+ <span class='object_link'>
18
+ <a href="<%= url_for(scenario.feature,"scenario#{index}") %>">
19
+ <%= h scenario.value %>
20
+ </a>
21
+ </span>
22
+ <small><%= scenario.location %></small>
19
23
  </li>
20
24
  <% n = n == 2 ? 1 : 2 %>
21
25
  <% end %>
@@ -10,27 +10,105 @@ function cucumberSearchFrameLinks() {
10
10
  $(cucumberSearchFrameLinks);
11
11
 
12
12
 
13
+ $(function() {
14
+
15
+ //
16
+ // Feature Page - Scenarios
17
+ //
18
+ $('.scenario div.title').click(function(eventObject) {
19
+ if (typeof eventObject.currentTarget !== "undefined") {
20
+ toggleScenario( $($(eventObject.currentTarget).parent()) );
21
+ }
22
+ });
13
23
 
14
- function toggleScenarioExample(id,example) {
15
-
16
- var element = $("#" + id + "Example" + example + "Steps")[0];
24
+ //
25
+ // Developer View
26
+ // Click + Developer View = toggle the expansion of all tags, location, and comments
27
+ //
28
+ $('#view').click(function(eventObject) {
29
+
30
+ if (typeof eventObject.currentTarget !== "undefined") {
31
+ var view = eventObject.currentTarget;
32
+
33
+ if (view.innerHTML === '[More Detail]') {
34
+ $('.developer').show(500);
35
+ view.innerHTML = '[Less Detail]';
36
+ } else {
37
+ $('.developer').hide(500);
38
+ // Already hidden elements with .developer sub-elements were not getting message
39
+ $('.developer').each(function() { $(this).css('display','none'); });
40
+ view.innerHTML = '[More Detail]';
41
+ }
42
+ }
43
+ });
17
44
 
18
- $('#' + id + ' tr').each(function(index) {
19
- this.style.backgroundColor = (index % 2 == 0 ? '#FFFFFF' : '#F0F6F9' );
45
+ //
46
+ // Expand/Collapse All
47
+ //
48
+ $('#expand').click(function(eventObject) {
49
+
50
+ if (typeof eventObject.currentTarget !== "undefined") {
51
+ if (eventObject.currentTarget.innerHTML === '[Expand All]') {
52
+ eventObject.currentTarget.innerHTML = '[Collapse All]';
53
+ $('div.scenario > div.details:hidden').each(function() {
54
+ toggleScenario( $($(this).parent()) );
55
+ });
56
+ } else {
57
+ eventObject.currentTarget.innerHTML = '[Expand All]';
58
+ $('div.scenario > div.details:visible').each(function() {
59
+ toggleScenario( $($(this).parent()) );
60
+ });
61
+ }
62
+ }
20
63
  });
21
64
 
22
- if (element.style.display != 'none') {
23
- element = $("#" + id + "Steps")[0];
24
- } else {
25
- $('#' + id + ' .outline * tr')[example].style.backgroundColor = '#FFCC80';
26
- }
65
+ //
66
+ // Scenario Outlines - Toggle Examples
67
+ //
68
+ $('.outline table tr').click(function(eventObject) {
69
+
70
+ if (typeof eventObject.currentTarget !== "undefined") {
71
+ var exampleRow = $(eventObject.currentTarget);
72
+ var exampleClass = eventObject.currentTarget.className.match(/example\d+/)[0];
73
+ var example = exampleRow.closest('div.details').find('.' + exampleClass);
74
+
75
+ var currentExample = null;
76
+
77
+ $('.outline table tr').each(function() { $(this).removeClass('selected'); });
78
+
79
+ if ( example[0].style.display == 'none' ) {
80
+ currentExample = example[0];
81
+ exampleRow.addClass('selected');
82
+ } else {
83
+ currentExample = exampleRow.closest('div.details').find('.steps')[0];
84
+ }
85
+
86
+ // hide everything
87
+ exampleRow.closest('div.details').find('.steps').each(function() { $(this).hide(); });
88
+
89
+ // show the selected
90
+ $(currentExample).show();
91
+ }
92
+ });
27
93
 
28
- $('#' + id + ' .steps').each(function(index) {
29
- this.style.display = 'none';
30
- });
31
94
 
32
- element.style.display = 'block';
95
+ });
96
+
33
97
 
98
+ function toggleScenario(scenario) {
99
+
100
+ var state = scenario.find(".attributes input[name='collapsed']")[0];
101
+
102
+ if (state.value === 'true') {
103
+ scenario.find("div.details").each(function() { $(this).show(500); });
104
+ state.value = "false";
105
+ scenario.find('a.toggle').each(function() { this.innerHTML = ' - '; });
106
+
107
+ } else {
108
+ scenario.find("div.details").each(function() { $(this).hide(500); });
109
+ state.value = "true";
110
+ scenario.find('a.toggle').each(function() { this.innerHTML = ' + '; });
111
+ }
34
112
  }
35
113
 
36
114
 
@@ -54,7 +132,9 @@ function determineTagsUsedInFormula(tagString) {
54
132
  tagGroup.forEach(function(tag, index, array) {
55
133
  //console.log("Tag Group: " + tag);
56
134
  var validTags = removeInvalidTags(tag)
57
- if (validTags != "") { returnTags.push(validTags); }
135
+ if (validTags != "") {
136
+ returnTags.push(validTags);
137
+ }
58
138
  });
59
139
  }
60
140
 
@@ -84,27 +164,27 @@ function displayExampleCommandLine(tags) {
84
164
 
85
165
  function hideEmptySections() {
86
166
 
87
- ["feature","scenario"].forEach(function(section,index,sections) {
167
+ ["feature","scenario"].forEach(function(section,index,sections) {
88
168
 
89
- if ( $("." + section + ":visible").length == 0 ) {
90
- $("#" + section + "s")[0].style.display = "none";
91
- } else {
92
- $("#" + section + "s")[0].style.display = "block";
93
- }
169
+ if ( $("." + section + ":visible").length == 0 ) {
170
+ $("#" + section + "s")[0].style.display = "none";
171
+ } else {
172
+ $("#" + section + "s")[0].style.display = "block";
173
+ }
94
174
 
95
- });
175
+ });
96
176
  }
97
177
 
98
178
  function fixSectionRowAlternations() {
99
179
 
100
- ["feature","scenario"].forEach(function(section,index,sections) {
180
+ ["feature","scenario"].forEach(function(section,index,sections) {
101
181
 
102
- $("." + section + ":visible")
103
- $("." + section + ":visible").each(function(index) {
104
- $(this).removeClass("r1 r2").addClass("r" + ((index % 2) + 1));
105
- });
182
+ $("." + section + ":visible")
183
+ $("." + section + ":visible").each(function(index) {
184
+ $(this).removeClass("r1 r2").addClass("r" + ((index % 2) + 1));
185
+ });
106
186
 
107
- });
187
+ });
108
188
  }
109
189
 
110
190
  function displayQualifyingFeaturesAndScenarios(tags) {
@@ -33,7 +33,7 @@
33
33
  <span class="defined">
34
34
  <%= link_transformed_step(step) %>
35
35
  </span>
36
- <div class="details"><a href="<%= url_for step.scenario.feature %>"><%= h(step.location) %></a></div>
36
+ <div class="definition"><a href="<%= url_for step.scenario.feature %>"><%= h(step.location) %></a></div>
37
37
  </div>
38
38
  <% end %>
39
39
  <% else %>
@@ -7,7 +7,7 @@
7
7
  <span class="undefined">
8
8
  <%= h step.value %>
9
9
  </span>
10
- <div class="details">
10
+ <div class="definition">
11
11
  <a href="<%= url_for step.scenario.feature %>"><%= h(step.location) %></a>
12
12
  </div>
13
13
  </div>
@@ -15,7 +15,11 @@
15
15
  <ul>
16
16
  <% objects.each do |obj| %>
17
17
  <li>
18
- <%= linkify obj.feature, obj.value %>
18
+ <span class='object_link'>
19
+ <a href="<%= url_for(obj.feature,"scenario#{obj.feature.scenarios.index(obj) }") %>">
20
+ <%= h obj.value %>
21
+ </a>
22
+ </span>
19
23
  <% if !obj.namespace.root? %>
20
24
  <small>(<%= obj.namespace.file %>)</small>
21
25
  <% end %>
@@ -3,12 +3,12 @@
3
3
  module YARD::CodeObjects::Cucumber
4
4
 
5
5
  class Scenario < NamespaceObject
6
-
6
+
7
7
  attr_accessor :value, :comments, :keyword, :description, :steps, :tags, :feature
8
8
 
9
9
  def initialize(namespace,name)
10
10
  super(namespace,name.to_s.strip)
11
- @commants = @description = @keyword = @value = @feature = nil
11
+ @comments = @description = @keyword = @value = @feature = nil
12
12
  @steps = []
13
13
  @tags = []
14
14
  end
@@ -4,7 +4,7 @@ module YARD::CodeObjects::Cucumber
4
4
 
5
5
  class ScenarioOutline < NamespaceObject
6
6
 
7
- attr_accessor :value, :comments, :description, :steps, :tags, :feature
7
+ attr_accessor :value, :comments, :keyword, :description, :steps, :tags, :feature
8
8
  attr_accessor :scenarios, :examples
9
9
 
10
10
  def initialize(namespace,name)
@@ -4,11 +4,11 @@ module YARD::CodeObjects::Cucumber
4
4
 
5
5
  class Step < Base
6
6
 
7
- attr_accessor :definition, :examples, :keyword, :scenario, :table, :text, :transforms, :value
7
+ attr_accessor :comments, :definition, :examples, :keyword, :scenario, :table, :text, :transforms, :value
8
8
 
9
9
  def initialize(namespace,name)
10
10
  super(namespace,name.to_s.strip)
11
- @definition = @description = @keyword = @table = @text = @value = nil
11
+ @comments = @definition = @description = @keyword = @table = @text = @value = nil
12
12
  @examples = {}
13
13
  @transforms = []
14
14
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-in-the-yard
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 7
9
- - 0
10
- version: 1.7.0
9
+ - 1
10
+ version: 1.7.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Franklin Webber
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-18 00:00:00 -08:00
18
+ date: 2010-11-28 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -98,7 +98,6 @@ files:
98
98
  - lib/docserver/default/layout/html/headers.erb
99
99
  - lib/docserver/doc_server/full_list/html/full_list.erb
100
100
  - lib/docserver/doc_server/full_list/html/setup.rb
101
- - lib/templates/default/feature/html/background.erb
102
101
  - lib/templates/default/feature/html/feature.erb
103
102
  - lib/templates/default/feature/html/no_steps_defined.erb
104
103
  - lib/templates/default/feature/html/outline.erb
@@ -164,11 +163,14 @@ post_install_message: |+
164
163
 
165
164
  (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
166
165
 
167
- Thank you for installing Cucumber-In-The-YARD 1.7.0 / 2010-11-18.
166
+ Thank you for installing Cucumber-In-The-YARD 1.7.1 / 2010-11-28.
168
167
 
169
168
  Changes:
170
169
 
171
- * Dynamic Tag Union / Intersection
170
+ * Feature file with layout enhancements
171
+ * Scenarios are now linked/linkable
172
+ * FIX Scenario Outline error on CentOS, Ruby 1.8.7
173
+ * FIX Requiring Cucumber before Gherkin so that correct gherkin is loaded
172
174
 
173
175
 
174
176
  (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
@@ -1,92 +0,0 @@
1
-
2
- <script type="text/javascript" charset="utf-8">
3
- $(function() {
4
- $('#background .toggle').click(function() {
5
- $("#backgroundSteps").toggle('blind');
6
-
7
- var stateIndicator = $('#background a.toggle')[0]
8
-
9
- stateIndicator.innerHTML = (stateIndicator.innerHTML === '+' ? '-' : '+');
10
- return false;
11
- });
12
- });
13
- </script>
14
-
15
- <div id="background">
16
- <div class="title">
17
- <a class="toggle">-</a>
18
- <span class="pre">Background</span>
19
- </div>
20
- <% unless @feature.background.description.empty? %>
21
- <div class="description">
22
- <%= h(@feature.background.description) %>
23
- </div>
24
- <% end %>
25
-
26
- <!-- Background and scenario should have the same display with some minor changes -->
27
-
28
- <div id="backgroundSteps" class="steps">
29
- <% if @feature.background.steps %>
30
- <% @feature.background.steps.each_with_index do |step,index| %>
31
- <div <%= "id='backgroundStep#{index}'" %> class="step <%= (index + 1) % 2 == 0 ? 'even' : 'odd' %>">
32
- <span class="predicate"><%= step.keyword %></span>
33
-
34
- <% if step.definition %>
35
- <script type="text/javascript" charset="utf-8">
36
- $('<%= "#backgroundStep#{index}" %>').hover(
37
- function () { $('<%= "#backgroundStep#{index} div.details" %>').toggle('slide'); },
38
- function () { $('<%= "#backgroundStep#{index} div.details" %>').toggle('slide'); }
39
- );
40
-
41
- $('<%= "#backgroundStep#{index} div.details" %>').show();
42
-
43
- </script>
44
- <span class="defined">
45
- <a href="steptransformers.html#<%= step.definition.name %>"><%= h(step.value) %></a>
46
- <div class="details" style="display: none;">
47
- (<%= h( step.definition.location ) %>)
48
- </div>
49
- </span>
50
- <% else %>
51
- <span class="undefined"><%= h(step.value) %></span>
52
- <% end %>
53
-
54
- </div>
55
-
56
- <% if step.has_table? %>
57
- <div class="multiline">
58
- <table style="">
59
-
60
- <thead>
61
- <tr>
62
- <% step.table.first.each_with_index do |column,column_index| %>
63
- <th class="<%= (column_index + 1) % 2 == 0 ? 'even' : 'odd' %>"><%= h(column.strip) %></th>
64
- <% end %>
65
- </tr>
66
- </thead>
67
-
68
- <% step.table[1..-1].each_with_index do |row,row_index| %>
69
- <tr class="<%= (row_index + 1) % 2 == 0 ? 'even' : 'odd' %>">
70
- <% row.each_with_index do |column,column_index| %>
71
- <td><%= h(column.strip) %></td>
72
- <% end %>
73
- </tr>
74
- <% end %>
75
- </table>
76
- </div>
77
- <% end %>
78
-
79
- <% if step.has_text? %>
80
- <div class="text">
81
- <%= h(step.text) %>
82
- </div>
83
- <% end %>
84
-
85
-
86
- <% end %>
87
- <% else %>
88
- <span>No Steps Defined</span>
89
- <% end %>
90
- </div>
91
-
92
- </div>