cucumber-in-the-yard 1.7.2 → 1.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/History.txt +12 -0
  2. data/README.md +22 -0
  3. data/example/child_feature/child.feature +11 -0
  4. data/example/child_feature/grandchild_feature/grandchild.feature +12 -0
  5. data/example/scenario.feature +23 -13
  6. data/example/scenario_outline.feature +26 -6
  7. data/lib/city.rb +1 -1
  8. data/lib/cucumber/city_builder.rb +2 -2
  9. data/lib/templates/default/feature/html/feature.erb +24 -18
  10. data/lib/templates/default/feature/html/outline.erb +21 -6
  11. data/lib/templates/default/feature/html/pystring.erb +1 -1
  12. data/lib/templates/default/feature/html/scenario.erb +3 -2
  13. data/lib/templates/default/feature/html/steps.erb +1 -1
  14. data/lib/templates/default/feature/setup.rb +4 -0
  15. data/lib/templates/default/featuredirectory/html/setup.rb +1 -0
  16. data/lib/templates/default/featuretags/html/namespace.erb +68 -34
  17. data/lib/templates/default/featuretags/html/setup.rb +4 -3
  18. data/lib/templates/default/fulldoc/html/css/common.css +40 -25
  19. data/lib/templates/default/fulldoc/html/full_list.erb +2 -0
  20. data/lib/templates/default/fulldoc/html/js/cucumber.js +60 -32
  21. data/lib/templates/default/fulldoc/html/setup.rb +1 -1
  22. data/lib/templates/default/requirements/html/setup.rb +3 -0
  23. data/lib/templates/default/steptransformers/html/header.erb +5 -5
  24. data/lib/templates/default/steptransformers/html/transformers.erb +55 -49
  25. data/lib/templates/default/steptransformers/html/undefined_steps.erb +12 -6
  26. data/lib/templates/default/steptransformers/setup.rb +6 -0
  27. data/lib/yard/code_objects/cucumber/feature.rb +2 -2
  28. data/lib/yard/code_objects/cucumber/scenario_outline.rb +6 -1
  29. metadata +16 -10
  30. data/example/child_feature/grandchild_feature/scenario.feature +0 -52
  31. data/example/child_feature/scenario.feature +0 -57
@@ -1,3 +1,15 @@
1
+ === 1.7.3 / 2010-12-06
2
+
3
+ * Shortcut Keys (t) for tags and (r) for features (f was taken)
4
+ * Step definitions/transforms consolidate steps for easier viewing
5
+ and when they have no steps they are colored differently
6
+ * Tag filtering supports inverse (~) of tags
7
+
8
+ * FIX Scenario Outlines without examples will not crash the parser
9
+ * FIX Features, Scenarios, and Directories should display in alphabetic order
10
+ * FIX Comments and multiline strings will display correctly
11
+ * FIX Feature comments will show
12
+
1
13
  === 1.7.2 / 2010-11-30
2
14
 
3
15
  * Step Definition and Transform page enhancements
data/README.md CHANGED
@@ -108,7 +108,29 @@ scale to test the functionality of small software component. Though, ultimately
108
108
  functionality may provide a valuable tool for many as I feel it helps more solidly bridge the reporting of
109
109
  the documentation by putting a coat of paint on it.
110
110
 
111
+
112
+ Short Term Goals
113
+ ----------------
114
+
115
+ 1. Add the features listing to the index.html
116
+ 2. The landing page for 'All features' should be requirements landing page.
117
+ 3. 'All Features' takes you to all the features.
118
+ * represent the file structure in a file structure way and change
119
+ the subtitle 'subdirectories' to 'features by directory' and
120
+ show the directory headings with the features within them
121
+ 6. Provide readme.md markdown support within each of the feature subdirectories
122
+ 7. Tag filering
123
+ * create and provide a video link of how to filter
124
+ * allow you to remove tag elements visually with the mouse click
125
+ * provide a copy to clipboard for the command line execution
126
+ 8. Step Transformers
127
+ * provide copy to clipboard
128
+ * Think of a way to illustrate that a step has a transform being applied
129
+ 9. Feature Directory
130
+ * Layout of the subdirectories should be more directory like and provide more information
111
131
  Roadmap
132
+ * Parent directories of directories contain no feature/scenario/tags statistics
133
+
112
134
  -------
113
135
 
114
136
  **Future Feature Ideas**
@@ -0,0 +1,11 @@
1
+ @scenarios
2
+ Feature: Child Feature
3
+ As a reader of the documentation I expect that scenario are documented correctly
4
+
5
+ Background:
6
+ Given this background step
7
+
8
+ Scenario: Child Scenario
9
+ Given this first step
10
+ When this second step
11
+ Then this third step
@@ -0,0 +1,12 @@
1
+ @scenarios
2
+ Feature: Grandchild Feature
3
+ As a reader of the documentation I expect that scenario are documented correctly
4
+
5
+ Background:
6
+ Given this background step
7
+
8
+ @first
9
+ Scenario: Grandchild Scenario
10
+ Given this first step
11
+ When this second step
12
+ Then this third step
@@ -1,7 +1,9 @@
1
- @scenarios @bvt
2
- Feature: Scenario
1
+ # Comments that appear before the feature are associated with the feature
2
+ @scenarios
3
+ Feature: Displaying Scenarios
3
4
  As a reader of the documentation I expect that scenario are documented correctly
4
-
5
+
6
+ # Comments after the feature description belong to the background or first scenario
5
7
  Background:
6
8
  Given this background step
7
9
 
@@ -11,9 +13,9 @@ Feature: Scenario
11
13
  @second
12
14
  Scenario: Scenario With Steps
13
15
  Given this first step
14
- When this second step
15
- Then this third step
16
-
16
+ When this second step
17
+ Then this third step
18
+
17
19
  @third @optional_parameters
18
20
  Scenario: Optional Parameter Step Definition
19
21
  # This step definition has some optional parameters
@@ -35,17 +37,25 @@ Feature: Scenario
35
37
  @sixth @text
36
38
  Scenario: Scenario With Text
37
39
  Given the following text:
38
- """
39
- Oh what a bother!
40
- """
40
+ """
41
+ Oh what a bother!
42
+ That this text has to take up two lines
43
+ """
41
44
 
45
+ # Comments before the scenario
42
46
  @seventh @comments
43
- Scenario: Scenario with comments and
44
- with multiple lines for the name
45
-
47
+ Scenario: Scenario with comments and a description
48
+ There once was a need for information to be displayed alongside all the
49
+ entities that I hoped to test
46
50
  # First Comment
47
51
  Given this first step
48
- # Second Comment
52
+ # Second Comment that
53
+ # spans a few lines
49
54
  And this second step
50
55
  # Third Comment
51
56
  And this third step
57
+ # Comments after the last step, where do they go?
58
+
59
+ Scenario: Step ending with a match with double-quotes
60
+ When searching the log for the exact match of the message "Entering application."
61
+ When the step definition has HTML escaped characters like: "<>&"
@@ -1,5 +1,5 @@
1
1
  @scenario_outlines @bvt
2
- Feature: Scenario Outline
2
+ Feature: Displaying Scenario Outlines
3
3
  As a reader of the documentation I expect that scenario outlines are documented correctly
4
4
 
5
5
  @first
@@ -22,7 +22,7 @@ Feature: Scenario Outline
22
22
  The <noun> jumped over the <place>
23
23
  """
24
24
  When I click on an example row
25
- Then I expect <noun> to be replaced by the example noun
25
+ Then I expect <noun> to be replaced by the example noun
26
26
  And I expect <place> to be replaced by the example place
27
27
 
28
28
  Examples:
@@ -36,7 +36,7 @@ Feature: Scenario Outline
36
36
  | name | price | quantity |
37
37
  | <name> | <price> | 100000 |
38
38
  When I click on an example row
39
- Then I expect <name> to be replaced by the example name
39
+ Then I expect <name> to be replaced by the example name
40
40
  And I expect <price> to be replaced by the example price
41
41
 
42
42
  Examples:
@@ -49,12 +49,32 @@ Feature: Scenario Outline
49
49
  Given the following table:
50
50
  | name | <denomination> | quantity |
51
51
  | <name> | <price> | 100000 |
52
- When I click on an example row
53
- Then I expect <name> to be replaced by the example name
52
+ When I click on an example row
53
+ Then I expect <name> to be replaced by the example name
54
54
  And I expect <price> to be replaced by the example price
55
55
  And I expect <denomination> to be replaced by the example denomination
56
56
 
57
57
  Examples:
58
58
  | name | price | denomination |
59
59
  | toy | 99 | cost in euros |
60
- | game | 49 | cost in dollars |
60
+ | game | 49 | cost in dollars |
61
+
62
+ # This is an example of a scenario outline in development.
63
+ # The example table has not been defined yet
64
+ Scenario Outline: Example Table Missing
65
+ When I click on an example row
66
+ Then I expect <name> to be replaced by the example name
67
+ And I expect <price> to be replaced by the example price
68
+ And I expect <denomination> to be replaced by the example denomination
69
+
70
+
71
+ # This is an example of a scenario outline in development.
72
+ # The examples table has been defined, but is missing data.
73
+ Scenario Outline: Empty Example Table
74
+ When I click on an example row
75
+ Then I expect <name> to be replaced by the example name
76
+ And I expect <price> to be replaced by the example price
77
+ And I expect <denomination> to be replaced by the example denomination
78
+
79
+ Examples:
80
+ | name | price | denomination |
@@ -3,7 +3,7 @@ require 'gherkin/parser/parser'
3
3
  require 'gherkin/formatter/tag_count_formatter'
4
4
 
5
5
  module CucumberInTheYARD
6
- VERSION = '1.7.2' unless defined?(CucumberInTheYARD::VERSION)
6
+ VERSION = '1.7.3' unless defined?(CucumberInTheYARD::VERSION)
7
7
  end
8
8
 
9
9
  require File.dirname(__FILE__) + "/yard/code_objects/cucumber/base.rb"
@@ -15,7 +15,6 @@ module Cucumber
15
15
  end
16
16
 
17
17
  def find_or_create_namespace(file)
18
- # TODO: The directory that is added should have the full path
19
18
  file.split('/')[0..-2].each do |directory|
20
19
  @namespace = @namespace.children.find {|child| child.name == directory } ||
21
20
  YARD::CodeObjects::Cucumber::FeatureDirectory.new(@namespace,directory) {|dir| dir.add_file(directory)}
@@ -101,7 +100,7 @@ module Cucumber
101
100
  end
102
101
 
103
102
  def examples(examples)
104
- #log.debug "EXAMPLES #{examples.name}"
103
+ #log.debug "EXAMPLES"
105
104
 
106
105
  @step_container.examples = { :keyword => examples.keyword,
107
106
  :name => examples.name,
@@ -132,6 +131,7 @@ module Cucumber
132
131
  end
133
132
 
134
133
  @step_container.example_values_for_row(row_index).each do |key,text|
134
+ text ||= "" #handle empty cells in the example table
135
135
  step_instance.value.gsub!("<#{key}>",text)
136
136
  step_instance.text.gsub!("<#{key}>",text) if step_instance.has_text?
137
137
  step_instance.table.each{|row| row.each{|col| col.gsub!("<#{key}>",text)}} if step_instance.has_table?
@@ -1,32 +1,38 @@
1
1
  <script type="text/javascript" charset="utf-8">
2
- $(function() {
3
- $(".developer").hide();
4
- });
2
+ $(function() {
3
+ $(".developer").hide();
4
+ });
5
5
  </script>
6
6
 
7
7
  <div class="feature">
8
8
  <div class="title">
9
+ <a id="view" class="control" href="#">[More Detail]</a>
10
+ <a id="expand" class="control" href="#">[Collapse All]</a>
11
+ <div style="clear: right;"></div>
9
12
  <span class="pre"><%= @feature.keyword %>:</span>
10
13
  <span class="name"><%= @feature.value %></span>
14
+ </div>
11
15
 
12
- <div id="view" class="control">[More Detail]</div>
13
- <div id="expand" class="control">[Collapse All]</div>
14
- </div>
16
+ <% if @feature.comments.length > 0 %>
17
+ <div class="comments developer">
18
+ <%= htmlify_with_newlines @feature.comments %>
19
+ </div>
20
+ <% end %>
15
21
 
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 %>
22
+ <div class="description">
23
+ <%= htmlify_with_newlines @feature.description %>
23
24
  </div>
24
- </div>
25
25
 
26
- <div class="description">
27
- <%= @feature.description %>
28
- </div>
26
+ <div class="meta">
27
+ <div class="file developer"><%= h(@feature.file) %></div>
28
+ <div style="clear: right;"></div>
29
+ <div class="tags developer">
30
+ <% @feature.tags.each do |tag| %>
31
+ <a href="<%= url_for tag %>"><%= tag.value %></a>
32
+ <% end %>
33
+ </div>
34
+ </div>
29
35
 
30
- <%= yieldall %>
36
+ <%= yieldall %>
31
37
  </div>
32
38
 
@@ -7,7 +7,9 @@
7
7
  <% end %>
8
8
 
9
9
  <div class="outline">
10
- <div class="keyword"> <%= h @scenario.example_keyword %> </div>
10
+
11
+ <% if @scenario.examples? %>
12
+ <div class="keyword"> <%= h @scenario.example_keyword %></div>
11
13
  <table>
12
14
  <thead>
13
15
  <tr>
@@ -16,12 +18,25 @@
16
18
  <% end %>
17
19
  </tr>
18
20
  </thead>
19
- <% @scenario.example_data.each_with_index do |row,row_index| %>
20
- <tr class="<%= (row_index + 1) % 2 == 0 ? "even example#{row_index +1}" : "odd example#{row_index +1}" %>">
21
- <% row.each_with_index do |column,column_index| %>
22
- <td><%= h(column.to_s.strip) %></td>
21
+ <% unless @scenario.example_data.empty? %>
22
+ <% @scenario.example_data.each_with_index do |row,row_index| %>
23
+ <tr class="<%= (row_index + 1) % 2 == 0 ? "even example#{row_index +1}" : "odd example#{row_index +1}" %>">
24
+ <% row.each_with_index do |column,column_index| %>
25
+ <td><%= h(column.to_s.strip) %></td>
26
+ <% end %>
27
+ </tr>
23
28
  <% end %>
24
- </tr>
29
+ <% else %>
30
+ <!-- Scenario Outline example table is empty -->
31
+ <tr class="odd">
32
+ <td colspan="<%= @scenario.example_headers.length %>" style="text-align: center;">
33
+ No Examples Defined
34
+ </td>
35
+ </tr>
25
36
  <% end %>
26
37
  </table>
38
+ <% else %>
39
+ <div class="keyword">No Example Table Defined</div>
40
+ <div class="keyword suggestion developer">[!] Did you mean to create a Scenario?</div>
41
+ <% end %>
27
42
  </div>
@@ -1,3 +1,3 @@
1
1
  <div class="text">
2
- <%= h @step.text %>
2
+ <%= htmlify_with_newlines @step.text %>
3
3
  </div>
@@ -4,17 +4,18 @@
4
4
  <a class="toggle"> - </a>
5
5
  <span class="pre"><%= @scenario.keyword %>:</span>
6
6
  <span class="name"><%= h @scenario.value %></span>
7
+ <a style="float:right; clear:right;" href="<% url_for(@scenario.feature,"scenario#{@id}") %>">link</a>
7
8
  </div>
8
9
 
9
10
  <% if @scenario.description.length > 0 %>
10
11
  <div class="description">
11
- <%= h @scenario.description %>
12
+ <%= htmlify_with_newlines @scenario.description %>
12
13
  </div>
13
14
  <% end %>
14
15
 
15
16
  <% if @scenario.comments.length > 0 %>
16
17
  <div class="comments developer">
17
- <%= h @scenario.comments %>
18
+ <%= htmlify_with_newlines @scenario.comments %>
18
19
  </div>
19
20
  <% end %>
20
21
 
@@ -2,7 +2,7 @@
2
2
  <% @step = step %>
3
3
 
4
4
  <% if step.comments && step.comments.length > 0 %>
5
- <div class="comments developer"><%= h step.comments %></div>
5
+ <div class="comments developer"><%= htmlify_with_newlines step.comments %></div>
6
6
  <% end %>
7
7
  <div class="step <%= (index + 1) % 2 == 0 ? 'even' : 'odd' %>">
8
8
  <span class="predicate"><%= step.keyword %></span>
@@ -48,4 +48,8 @@ def highlight_matches(step)
48
48
  end
49
49
 
50
50
  value
51
+ end
52
+
53
+ def htmlify_with_newlines(text)
54
+ text.split("\n").collect {|c| h(c) }.join("<br/>")
51
55
  end
@@ -15,6 +15,7 @@ def all_types_by_letter(type)
15
15
  objects = @directory.children.find_all {|child| child.is_a?(type) }
16
16
  objects = run_verifier(objects)
17
17
  objects.each {|o| (hash[o.value.to_s[0,1].upcase] ||= []) << o }
18
+ hash.values.each {|v| v.sort! {|a,b| b.value.to_s <=> a.value.to_s } }
18
19
  hash
19
20
  end
20
21
 
@@ -4,6 +4,23 @@
4
4
  var tag_list = [ <%= tags.collect{|t| "'#{t.value}'" }.join(',') %> ];
5
5
 
6
6
  $(function() {
7
+
8
+ // On focus, remove all the shortcut keys
9
+ $("#tag_search").focus(function() {
10
+ $(document).unbind('keypress');
11
+ });
12
+
13
+ // On blur, return all the shortcut keys
14
+ $("#tag_search").blur(function() {
15
+ $(document).bind('keypress',keyboardShortcuts);
16
+ $(document).bind('keypress',cucumberKeyboardShortcuts);
17
+ });
18
+
19
+ $("#tag_search").keyup(function(evt) {
20
+ updateTagFiltering($("#tag_search")[0].value);
21
+ });
22
+
23
+
7
24
  $("#tag_search").keyup(function(evt) {
8
25
  updateTagFiltering($("#tag_search")[0].value);
9
26
  });
@@ -11,15 +28,29 @@
11
28
  $(".tag").click(function(evt) {
12
29
  if (typeof evt !== "undefined") {
13
30
 
14
- if (evt.ctrlKey === true) {
31
+ if (evt.shiftKey === true) {
15
32
  window.location = $(this).attr("href");
16
- } else if (evt.altKey === true ) {
17
- $("#tag_search")[0].value += ($("#tag_search")[0].value != "" ? "," : "") + this.innerHTML;
18
- updateTagFiltering($("#tag_search")[0].value);
33
+ return true;
34
+ }
35
+
36
+ var tagSearchElement = $("#tag_search")[0];
37
+
38
+ var tagToAdd = this.innerHTML;
39
+ var tagModifer = "";
40
+
41
+ if (evt.altKey === true ) {
42
+ tagToAdd = "~" + tagToAdd;
43
+ }
44
+
45
+ if (evt.ctrlKey === true ) {
46
+ tagModifier = ",";
19
47
  } else {
20
- $("#tag_search")[0].value += ($("#tag_search")[0].value != "" ? " " : "") + this.innerHTML;
21
- updateTagFiltering($("#tag_search")[0].value);
48
+ tagModifier = " ";
22
49
  }
50
+
51
+ tagSearchElement.value = (tagSearchElement.value != "" ? tagSearchElement.value + tagModifier : "") + tagToAdd;
52
+ updateTagFiltering(tagSearchElement.value);
53
+
23
54
  }
24
55
  });
25
56
  });
@@ -30,16 +61,19 @@
30
61
  </div>
31
62
 
32
63
  <div id="tag_filtering" >
33
- <span>Tag Filtering <a href="https://github.com/aslakhellesoy/cucumber/wiki/Tags" target="_blank">?</a></span>
64
+ <span style="font-size: 18px;">Tag Filtering <a href="https://github.com/aslakhellesoy/cucumber/wiki/Tags" target="_blank">?</a></span>
34
65
 
35
66
  <div style="clear: both"></div>
36
67
 
37
- <div style="float: left; margin-top: 10px; font-size: 10px; font-style: italic;">
38
- Left-click tags to 'AND'; ALT left-click tags to 'OR'
68
+ <div style="float: left; margin-top: 10px; padding-left: 5px; line-height: 1.5; font-size: 10px; font-style: italic;">
69
+ Type in tags with spaces between to 'AND' and commas between to 'OR'<br/>
70
+ LEFT CLICK to AND tags; CTRL+LEFT CLICK to OR tags; hold ALT for inverse (~) tags
39
71
  </div>
40
72
 
73
+ <div style="clear: both;"></div>
74
+
41
75
  <div style="float: right;">
42
- <a href="" onclick=" updateTagFiltering(""); return true;">clear</a>
76
+ <a href="#" onclick="clearTagFiltering(); $('#tag_search')[0].value = ''; return true;">clear</a>
43
77
  </div>
44
78
 
45
79
  <div style="clear: both"></div>
@@ -58,37 +92,37 @@
58
92
  <span class="name">Features</span>
59
93
  </div>
60
94
  <% n = 1 %>
95
+ <ul style="padding-left: 0px;">
61
96
  <% features.each do |feature| %>
62
- <li class="feature r<%= n %> <%= feature.tags.collect{|t| t.value }.join(" ") %>">
97
+ <li class="feature <%= n % 2 == 0 ? 'even' : 'odd' %> <%= feature.tags.collect {|t| t.value}.join(" ") %>">
63
98
  <%= linkify feature, feature.value %>
64
- <% itags = feature.tags.collect{|t| tagify(t) }.join(", ") %>
65
- <% if itags && itags != "" %>
66
- - <small><%= itags %></small>
99
+ <% ftags = feature.tags.collect{|t| tagify(t) }.join(", ") %>
100
+ <% if ftags && ftags != "" %>
101
+ - <small><%= ftags %></small>
67
102
  <% end %>
68
103
  </li>
69
104
  <% n = n == 2 ? 1 : 2 %>
105
+ <% if feature.scenarios %>
106
+ <ul style="padding-left: 20px;">
107
+ <% feature.scenarios.each do |scenario| %>
108
+ <li class="scenario <%= n % 2 == 0 ? 'even' : 'odd' %> <%= feature.tags.collect{|t| t.value }.join(" ") %> <%= scenario.tags.collect{|t| t.value }.join(" ") %>">
109
+ <span class='object_link'>
110
+ <a href="<%= url_for(scenario.feature,"scenario#{scenario.feature.scenarios.index(scenario) }") %>">
111
+ <%= h scenario.value %>
112
+ </a>
113
+ </span>
114
+ <% stags = scenario.tags.collect{|t| tagify(t) }.join(", ") %>
115
+ <% if stags && stags != "" %>
116
+ - <small><%= stags %></small>
117
+ <% end %>
118
+ </li>
119
+ <% n = n == 2 ? 1 : 2 %>
120
+ <% end %>
121
+ </ul>
70
122
  <% end %>
71
- </div>
72
-
73
- <div id="scenarios">
74
- <div class="title">
75
- <span class="name">Scenarios</span>
76
- </div>
77
- <% n = 1 %>
78
- <% scenarios.each_with_index do |scenario,index| %>
79
- <li class="scenario r<%= n %> <%= scenario.tags.collect{|t| t.value }.join(" ") %>">
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>
85
- <% itags = scenario.tags.collect{|t| tagify(t) }.join(", ") %>
86
- <% if itags && itags != "" %>
87
- - <small><%= itags %></small>
88
- <% end %>
89
- </li>
90
- <% n = n == 2 ? 1 : 2 %>
91
123
  <% end %>
124
+ </ul>
125
+ <div class="undefined" style="display:none;">No Features or Scenarios match the Tag Expression</div>
92
126
  </div>
93
127
 
94
128
  </div>