cucumber-in-the-yard 1.5.4 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. data/History.txt +6 -0
  2. data/README.md +18 -14
  3. data/city.gemspec +1 -1
  4. data/example/step_definitions/example.step.rb +4 -0
  5. data/example/sub_features/second_example.feature +51 -0
  6. data/lib/city.rb +1 -1
  7. data/lib/cucumber/city_builder.rb +3 -1
  8. data/lib/templates/default/feature/html/outline.erb +49 -17
  9. data/lib/templates/default/feature/html/scenario.erb +7 -9
  10. data/lib/templates/default/feature/html/steps.erb +17 -17
  11. data/lib/templates/default/feature/setup.rb +1 -1
  12. data/lib/templates/default/featuredirectory/html/directory.erb +76 -0
  13. data/lib/templates/default/featuredirectory/html/setup.rb +36 -0
  14. data/lib/templates/default/fulldoc/html/css/common.css +74 -60
  15. data/lib/templates/default/fulldoc/html/full_list_features.erb +3 -0
  16. data/lib/templates/default/fulldoc/html/full_list_tags.erb +4 -15
  17. data/lib/templates/default/fulldoc/html/js/cucumber.js +29 -7
  18. data/lib/templates/default/fulldoc/html/setup.rb +15 -11
  19. data/lib/templates/default/requirements/html/namespace.erb +76 -0
  20. data/lib/templates/default/requirements/html/setup.rb +35 -0
  21. data/lib/templates/default/scenario/html/scenario.erb +0 -3
  22. data/lib/templates/default/tag/html/feature.erb +28 -47
  23. data/lib/templates/default/tag/html/scenario.erb +28 -42
  24. data/lib/templates/default/tag/html/tag.erb +1 -0
  25. data/lib/templates/default/tag/setup.rb +15 -1
  26. data/lib/templates/default/tags/html/namespace.erb +39 -0
  27. data/lib/templates/default/tags/html/setup.rb +21 -0
  28. data/lib/yard/code_objects/cucumber/namespace_object.rb +16 -6
  29. metadata +16 -25
@@ -1,3 +1,6 @@
1
+ <li>
2
+ <%= linkify YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE, "All Features" %>
3
+ </li>
1
4
  <% @items.each do |feature| %>
2
5
  <li>
3
6
  <%= "<a class='toggle'></a>" unless feature.scenarios.empty? %>
@@ -1,23 +1,12 @@
1
+ <li>
2
+ <%= linkify YARD::CodeObjects::Cucumber::CUCUMBER_TAG_NAMESPACE, "All Tags" %>
3
+ </li>
1
4
  <% n = 1 %>
5
+
2
6
  <% @items.each do |tag| %>
3
7
  <li class="r<%= n %>">
4
- <a class='toggle'></a>
5
8
  <%= linkify tag, tag.value %>
6
9
  <small><%= tag.all_scenarios.size %></small>
7
10
  </li>
8
- <ul>
9
- <% tag.features.each do |feature| %>
10
- <li>
11
- <%= linkify feature, feature.value %>
12
- <small><%= feature.location %></small>
13
- </li>
14
- <% end %>
15
- <% tag.scenarios.each do |scenario| %>
16
- <li>
17
- <%= linkify scenario.feature, scenario.value %>
18
- <small><%= scenario.location %></small>
19
- </li>
20
- <% end %>
21
- </ul>
22
11
  <% n = n == 2 ? 1 : 2 %>
23
12
  <% end %>
@@ -1,10 +1,32 @@
1
1
  function cucumberSearchFrameLinks() {
2
- $('#feature_list_link').click(function() {
3
- toggleSearchFrame(this, relpath + 'feature_list.html');
4
- });
5
- $('#tagusage_list_link').click(function() {
6
- toggleSearchFrame(this, relpath + 'tag_list.html');
7
- });
2
+ $('#feature_list_link').click(function() {
3
+ toggleSearchFrame(this, relpath + 'feature_list.html');
4
+ });
5
+ $('#tagusage_list_link').click(function() {
6
+ toggleSearchFrame(this, relpath + 'tag_list.html');
7
+ });
8
8
  }
9
9
 
10
- $(cucumberSearchFrameLinks);
10
+ $(cucumberSearchFrameLinks);
11
+
12
+ function toggleScenarioExample(id,example) {
13
+
14
+ var element = $("#" + id + "Example" + example + "Steps")[0];
15
+
16
+ $('#' + id + ' tr').each(function(index) {
17
+ this.style.backgroundColor = (index % 2 == 0 ? '#FFFFFF' : '#F0F6F9' );
18
+ });
19
+
20
+ if (element.style.display != 'none') {
21
+ element = $("#" + id + "Steps")[0];
22
+ } else {
23
+ $('#' + id + ' .outline * tr')[example].style.backgroundColor = '#FFCC80';
24
+ }
25
+
26
+ $('#' + id + ' .steps').each(function(index) {
27
+ this.style.display = 'none';
28
+ });
29
+
30
+ element.style.display = 'block';
31
+
32
+ }
@@ -11,8 +11,6 @@ def init
11
11
  generate_full_list(@features)
12
12
  end
13
13
 
14
-
15
-
16
14
  @tags = Registry.all(:tag)
17
15
 
18
16
  if @tags
@@ -20,16 +18,12 @@ def init
20
18
  generate_full_list @tags.sort {|x,y| y.all_scenarios.size <=> x.all_scenarios.size }
21
19
  end
22
20
 
23
- #@scenarios = Registry.all(:scenario).find_all {|scenario| !scenario.background? }
24
- #generate_full_list(@scenarios) if @scenarios
21
+ feature_directories = YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE.children.find_all {|child| child.is_a?(YARD::CodeObjects::Cucumber::FeatureDirectory) }
25
22
 
26
- @steps = Registry.all(:step)
27
- generate_full_list(@steps) if @steps
28
-
29
- Templates::Engine.with_serializer(YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE, options[:serializer]) do
30
- options[:object] = YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE
31
- T('layout').run(options)
32
- end
23
+ serialize(YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE)
24
+ serialize(YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE)
25
+ serialize(YARD::CodeObjects::Cucumber::CUCUMBER_TAG_NAMESPACE)
26
+ serialize_feature_directories(feature_directories)
33
27
 
34
28
  end
35
29
 
@@ -54,4 +48,14 @@ def class_list(root = Registry.root)
54
48
  out = super(root)
55
49
  root.instance_eval { children << YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE } if root == Registry.root
56
50
  out
51
+ end
52
+
53
+ def serialize_feature_directories(namespaces)
54
+ namespaces.each do |namespace|
55
+ Templates::Engine.with_serializer(namespace, options[:serializer]) do
56
+ options[:object] = namespace
57
+ T('layout').run(options)
58
+ end
59
+ serialize_feature_directories(namespace.children.find_all {|child| child.is_a?(YARD::CodeObjects::Cucumber::FeatureDirectory)})
60
+ end
57
61
  end
@@ -0,0 +1,76 @@
1
+ <% if @namespace %>
2
+ <div id="cukes_logo">&nbsp;</div>
3
+ <div id="cukes_links">
4
+ <a href="http://cukes.info/">Cucumber</a> |
5
+ <a href="http://github.com/aslakhellesoy/cucumber/wiki/Gherkin">Gherkin</a> |
6
+ <a href="http://yardoc.org/">YARD</a> |
7
+ <a href="http://github.com/burtlo/Cucumber-In-The-Yard">Cucumber-In-The-YARD</a>
8
+ </div>
9
+
10
+ <div class="requirements">
11
+
12
+ <div class="summary">
13
+ <span class="name">Features:</span><span class="value"><%= features.size %></span>
14
+ <span class="name">Scenarios:</span><span class="value"><%= scenarios.size %></span>
15
+ <span class="name">Steps:</span><span class="value"><%= steps.size %></span>
16
+ <span class="name">Tags:</span><span class="value"><%= tags.size %></span>
17
+ </div>
18
+ <div class="tags"><span class="name">Tags:</span>
19
+ <%= tags.collect {|tag| linkify(tag,tag.value) }.join(",\n") %>
20
+ </div>
21
+
22
+ <div id="features" style="margin-left: 40px;">
23
+ <div class="title"><span class="name">Features</span></div>
24
+ </div>
25
+ <% i = 0 %>
26
+ <table style="margin-left: 10px;">
27
+ <tr>
28
+ <td valign='top' width="50%">
29
+ <% all_features_by_letter.sort_by {|l,o| l.to_s }.each do |letter, objects| %>
30
+ <% if (i += 1) % 13 == 0 %>
31
+ </td><td valign='top' width="50%">
32
+ <% i = 0 %>
33
+ <% end %>
34
+ <ul id="alpha_<%= letter %>" class="alpha">
35
+ <li class="letter"><%= letter %></li>
36
+ <ul>
37
+ <% objects.each do |obj| %>
38
+ <li>
39
+ <%= linkify obj, obj.value %>
40
+ <small>(<%= obj.file %>)</small>
41
+ </li>
42
+ <% end %>
43
+ </ul>
44
+ </ul>
45
+ <% end %>
46
+ </td>
47
+ </tr>
48
+ </table>
49
+
50
+ <% if @directories && !@directories.empty? %>
51
+ <div id="directory" style="margin-left: 40px;">
52
+ <div class="title"><span class="name">Subdirectories</span></div>
53
+ </div>
54
+ <% i = 0 %>
55
+ <table style="margin-left: 10px;">
56
+ <tr>
57
+ <td valign='top' width="33%">
58
+ <% @directories.each do |directory| %>
59
+ <% if (i += 1) % 8 == 0 %>
60
+ </td><td valign='top' width="33%">
61
+ <% i = 0 %>
62
+ <% end %>
63
+ <ul>
64
+ <%= linkify directory, directory.name %>
65
+ </ul>
66
+ <% end %>
67
+ </td>
68
+ </tr>
69
+ </table>
70
+
71
+ <% end %>
72
+
73
+ </div>
74
+ <% end %>
75
+
76
+
@@ -0,0 +1,35 @@
1
+ def init
2
+ super
3
+ sections.push :namespace
4
+ @namespace = object
5
+
6
+ end
7
+
8
+ def namespace
9
+ @directories = Registry.all(:featuredirectory)
10
+ erb(:namespace)
11
+ end
12
+
13
+ def all_features_by_letter
14
+ hash = {}
15
+ objects = features
16
+ objects = run_verifier(objects)
17
+ objects.each {|o| (hash[o.value.to_s[0,1].upcase] ||= []) << o }
18
+ hash
19
+ end
20
+
21
+ def features
22
+ Registry.all(:feature)
23
+ end
24
+
25
+ def scenarios
26
+ Registry.all(:scenario)
27
+ end
28
+
29
+ def steps
30
+ Registry.all(:step)
31
+ end
32
+
33
+ def tags
34
+ Registry.all(:tag)
35
+ end
@@ -14,9 +14,6 @@
14
14
  <div class="steps">
15
15
  <% unless @scenario.steps.empty? %>
16
16
  <% @scenario.steps.each do |step| %>
17
- <!-- TODO: Style the first word differently -->
18
- <!-- TODO: Link the step to the step definition -->
19
- <!-- TODO: Steps without links should appear different -->
20
17
  <div class="step"><span class="predicate"><%= step.keyword %></span>&nbsp;<%= step.line %></div>
21
18
  <% end %>
22
19
  <% else %>
@@ -1,48 +1,29 @@
1
- <% object.features.each do |feature| %>
2
- <div class="feature direct">
3
- <div class="title">
4
- <span class="pre"><%= feature.keyword %></span>
5
- <span class="name">
6
- <a href="<%= url_for feature %>"><%= feature.value %></a>
7
- </span>
8
- </div>
9
- <div class="meta">
10
- <div class="file"><%= h(feature.file) %></div>
11
- <div class="tags">Tags:
12
- <% feature.tags.each do |tag| %>
13
- <a href="<%= url_for tag %>"><%= tag.value %></a>
14
- <% end %>
15
- </div>
16
- </div>
17
- <div class="description">
18
- <%= feature.description %>
19
- </div>
1
+ <div id="features">
2
+ <div class="title"><span class="name">Features</span></div>
20
3
  </div>
21
- <% feature.scenarios.each do |scenario| %>
22
- <div class="scenario indirect">
23
- <div class="title">
24
- <span class="pre"><%= scenario.keyword %></span>
25
- <span class="name">
26
- <a href="<%= url_for feature %>"><%= scenario.value %></a>
27
- </span>
28
- </div>
29
- <div class="meta">
30
- <div class="file">
31
- <%= scenario.location %>
32
- </div>
33
- <% unless scenario.tags.empty? %>
34
- <div class="tags">
35
- Tags: <% scenario.tags.each do |tag| %>
36
- <a href="<%= url_for tag %>"><%= tag.value %></a>
37
- <% end %>
38
- </div>
39
- <% end%>
40
- </div>
41
- <% unless scenario.description.empty? %>
42
- <div class="description">
43
- <%= h scenario.description %>
44
- </div>
45
- <% end %>
46
- </div>
47
- <% end %>
48
- <% end %>
4
+ <% i = 0 %>
5
+ <table>
6
+ <tr>
7
+ <td valign='top' width="33%">
8
+ <% all_features_by_letter.sort_by {|l,o| l.to_s }.each do |letter, objects| %>
9
+ <% if (i += 1) % 8 == 0 %>
10
+ </td><td valign='top' width="33%">
11
+ <% i = 0 %>
12
+ <% end %>
13
+ <ul id="alpha_<%= letter %>" class="alpha">
14
+ <li class="letter"><%= letter %></li>
15
+ <ul>
16
+ <% objects.each do |obj| %>
17
+ <li>
18
+ <%= linkify obj, obj.value %>
19
+ <% if !obj.namespace.root? %>
20
+ <small>(<%= obj.namespace.file %>)</small>
21
+ <% end %>
22
+ </li>
23
+ <% end %>
24
+ </ul>
25
+ </ul>
26
+ <% end %>
27
+ </td>
28
+ </tr>
29
+ </table>
@@ -1,43 +1,29 @@
1
- <% object.scenarios.each do |scenario| %>
2
- <div class="feature indirect">
3
- <div class="title">
4
- <span class="pre"><%= scenario.feature.keyword %></span>
5
- <span class="name">
6
- <a href="<%= url_for scenario.feature %>"><%= scenario.feature.value %></a>
7
- </span>
8
- </div>
9
- <div class="meta">
10
- <div class="file"><%= h(scenario.feature.file) %></div>
11
- <div class="tags">Tags:
12
- <% scenario.feature.tags.each do |tag| %>
13
- <a href="<%= url_for tag %>"><%= tag.value %></a>
14
- <% end %>
15
- </div>
16
- </div>
17
- <div class="description"><%= scenario.feature.description %></div>
1
+ <div id="features">
2
+ <div class="title"><span class="name">Scenarios</span></div>
18
3
  </div>
19
-
20
- <div class="scenario direct">
21
- <div class="title">
22
- <span class="pre"><%= scenario.keyword %></span>
23
- <span class="name">
24
- <a href="<%= url_for scenario.feature %>"><%= scenario.value %></a>
25
- </span>
26
- </div>
27
- <div class="meta">
28
- <div class="file"><%= scenario.location %></div>
29
- <% unless scenario.tags.empty? %>
30
- <div class="tags">Tags:
31
- <% scenario.tags.each do |tag| %>
32
- <a href="<%= url_for tag %>"><%= tag.value %></a>
33
- <% end %>
34
- </div>
35
- <% end%>
36
- </div>
37
- <% unless scenario.description.empty? %>
38
- <div class="description">
39
- <%= h scenario.description %>
40
- </div>
41
- <% end %>
42
- </div>
43
- <% end %>
4
+ <% i = 0 %>
5
+ <table>
6
+ <tr>
7
+ <td valign='top' width="33%">
8
+ <% all_scenarios_by_letter.sort_by {|l,o| l.to_s }.each do |letter, objects| %>
9
+ <% if (i += 1) % 8 == 0 %>
10
+ </td><td valign='top' width="33%">
11
+ <% i = 0 %>
12
+ <% end %>
13
+ <ul id="alpha_<%= letter %>" class="alpha">
14
+ <li class="letter"><%= letter %></li>
15
+ <ul>
16
+ <% objects.each do |obj| %>
17
+ <li>
18
+ <%= linkify obj.feature, obj.value %>
19
+ <% if !obj.namespace.root? %>
20
+ <small>(<%= obj.namespace.file %>)</small>
21
+ <% end %>
22
+ </li>
23
+ <% end %>
24
+ </ul>
25
+ </ul>
26
+ <% end %>
27
+ </td>
28
+ </tr>
29
+ </table>
@@ -13,6 +13,7 @@
13
13
  </div>
14
14
  </div>
15
15
 
16
+ <div style="margin-top: 20px;">&nbsp;</div>
16
17
  <%= yieldall :object => @tag %>
17
18
 
18
19
  </div>
@@ -2,5 +2,19 @@ def init
2
2
  super
3
3
  @tag = object
4
4
 
5
- sections.push :tag, [:feature, :scenario]
5
+ sections.push :tag
6
+ sections.push :feature unless @tag.features.empty?
7
+ sections.push :scenario unless @tag.scenarios.empty?
8
+ end
9
+
10
+ def all_features_by_letter
11
+ hash = {}
12
+ @tag.features.each {|o| (hash[o.value.to_s[0,1].upcase] ||= []) << o }
13
+ hash
14
+ end
15
+
16
+ def all_scenarios_by_letter
17
+ hash = {}
18
+ @tag.scenarios.each {|o| (hash[o.value.to_s[0,1].upcase] ||= []) << o }
19
+ hash
6
20
  end
@@ -0,0 +1,39 @@
1
+ <% if @namespace %>
2
+ <div class="requirements">
3
+ <div class="title">
4
+ <span class="name">Tags</span>
5
+ </div>
6
+
7
+ <% i = 0 %>
8
+ <table style="margin-left: 10px;">
9
+ <tr>
10
+ <td valign='top' width="50%">
11
+ <% all_tags_by_letter.sort_by {|l,o| l.to_s }.each do |letter, objects| %>
12
+ <% if (i += 1) % 8 == 0 %>
13
+ </td><td valign='top' width="50%">
14
+ <% i = 0 %>
15
+ <% end %>
16
+ <ul id="alpha_<%= letter %>" class="alpha">
17
+ <li class="letter"><%= letter %></li>
18
+ <ul>
19
+ <% objects.each do |obj| %>
20
+ <li>
21
+ <%= linkify obj, obj.value %>
22
+ <small>
23
+ ( <%= obj.features.size > 0 ? "#{obj.features.size} feature#{obj.features.size > 1 ? 's' : ''}" : "" %>
24
+ <%= " and " if obj.features.size > 0 && obj.scenarios.size > 0 %>
25
+ <%= obj.scenarios.size > 0 ? "#{obj.scenarios.size} scenario#{obj.scenarios.size > 1 ? 's' : ''}" : "" %> )
26
+ </small>
27
+ </li>
28
+ <% end %>
29
+ </ul>
30
+ </ul>
31
+ <% end %>
32
+ </td>
33
+ </tr>
34
+ </table>
35
+
36
+ </div>
37
+ <% end %>
38
+
39
+