wally 0.0.17 → 0.0.18

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.
@@ -0,0 +1,19 @@
1
+ Feature: Counts
2
+ In order to understand the size of the project
3
+ As a stakeholder
4
+ I want a visual indication of the number of tags, scenarios and features
5
+
6
+ Scenario: Tags, scenarios, and features count
7
+ Given a feature file named "sample.feature" with the contents:
8
+ """
9
+ @tag1
10
+ Feature: Tag Feature
11
+ @tag2 @multiple
12
+ Scenario: Tag Foo 1
13
+ @tag3 @multiple
14
+ Scenario: Tag Bar 2
15
+ """
16
+ When I visit the home page
17
+ Then I should see a heading "Features (1)"
18
+ And I should see a heading "Tags (4)"
19
+ And I should see a heading "Scenarios (2)"
@@ -6,4 +6,4 @@ Feature: Notifications
6
6
  Scenario: Ten @wip tags
7
7
  Given a feature file with 10 @wip tags
8
8
  When I visit the home page
9
- Then I should see a notification that says "You have 10 @wip tags"
9
+ Then I should see a notification that says "You have 10 @wip tags :("
@@ -44,3 +44,9 @@ end
44
44
  Then /^the features are ordered alphabetically$/ do
45
45
  page.body.should =~ /Elle Macpherson.*Jessica-Jane Clement.*Kate Moss.*Katie Price/m
46
46
  end
47
+
48
+
49
+ Then /^I should see a heading "([^"]*)"$/ do |text|
50
+ page.body.should have_content text
51
+ end
52
+
@@ -13,13 +13,14 @@ before do
13
13
  @features = @lists_features.features
14
14
  @tag_count = Wally::CountsTags.new(@lists_features).count_tags
15
15
  @excessive_wip_tags = @tag_count["@wip"] >= 10
16
+ @scenario_count = @features.to_s.scan(/scenario/).length
16
17
  end
17
18
 
18
19
  get '/?' do
19
20
  haml :index
20
21
  end
21
22
 
22
- get '/features/:feature/?' do |feature|
23
+ get '/features/:feature/?' do |feature|
23
24
  @features.each do |feature_hash|
24
25
  @feature = feature_hash if feature_hash["id"] == feature
25
26
  end
@@ -40,7 +41,7 @@ get '/features/:feature/scenario/:scenario/?' do |feature_id, scenario_id|
40
41
  if element["type"] == "background"
41
42
  @background = element
42
43
  end
43
- if element["type"] == "scenario" && element["id"] == "#{feature_id};#{scenario_id}"
44
+ if (element["type"] == "scenario" || element["type"] == "scenario_outline") && element["id"] == "#{feature_id};#{scenario_id}"
44
45
  @scenario = element
45
46
  end
46
47
  end
@@ -58,7 +59,7 @@ def get_sorted_scenarios(feature)
58
59
 
59
60
  if feature["elements"]
60
61
  feature["elements"].each do |element|
61
- if element["type"] == "scenario"
62
+ if element["type"] == "scenario" || element["type"] == "scenario_outline"
62
63
  scenarios << element
63
64
  end
64
65
  end
@@ -8,14 +8,14 @@ module Wally
8
8
  @lists_features.features.inject(Hash.new(0)) do |tag_count, feature|
9
9
  if feature["tags"]
10
10
  feature["tags"].each do |tag|
11
- tag_count[tag["name"]] += 1
11
+ tag_count[tag["name"].downcase] += 1
12
12
  end
13
13
  end
14
14
  if feature["elements"]
15
15
  feature["elements"].each do |element|
16
16
  if element["tags"]
17
17
  element["tags"].each do |tag|
18
- tag_count[tag["name"]] += 1
18
+ tag_count[tag["name"].downcase] += 1
19
19
  end
20
20
  end
21
21
  end
@@ -18,7 +18,9 @@ module Wally
18
18
  def features
19
19
  features = []
20
20
  Dir.glob("#{@feature_path}/*.feature").each do |path|
21
- features << parse_gherkin(File.read(path))
21
+ gherkinese = parse_gherkin(File.read(path))
22
+ gherkinese["path"] = path
23
+ features << gherkinese
22
24
  end
23
25
  features.sort {|a,b| a["name"] <=> b["name"]}
24
26
  end
@@ -72,6 +72,7 @@ input, textarea, select, .uneditable-input {
72
72
  .sidebar {
73
73
  padding-top: 18px;
74
74
  padding-right: 19px;
75
+ padding-bottom: 200px;
75
76
  border-right: 1px solid #dfdfdf;
76
77
  }
77
78
 
@@ -102,6 +103,11 @@ p {
102
103
  content: "\2691";
103
104
  }
104
105
 
106
+ section.scenarios {
107
+ border-bottom: 1px dotted #ccc;
108
+ margin-bottom: 18px;
109
+ }
110
+
105
111
  section.feature p:first-child {
106
112
  white-space: pre-wrap
107
113
  }
data/lib/wally/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wally
2
- VERSION = "0.0.17"
2
+ VERSION = "0.0.18"
3
3
  end
@@ -1,3 +1,6 @@
1
+ - if @feature["path"]
2
+ %pre
3
+ = @feature["path"]
1
4
  - if @feature["description"]
2
5
  %h2 Scenarios
3
6
  %section{:class=>"scenarios"}
@@ -17,13 +17,20 @@
17
17
  %input.btn{:type => "submit", :id => "search", :value => "Search"}
18
18
  %div.container-fluid
19
19
  %div.sidebar
20
+ %ul
21
+ %li
22
+ %a{:href => "/search?q="}
23
+ = "Scenarios (#{@scenario_count})"
24
+ %li
25
+ %a{:href => "/"}
26
+ = "Features (#{@features.length})"
20
27
  %h2
21
28
  Features
22
29
  %ul
23
30
  - @features.each do |feature|
24
31
  = haml :feature_link, {:locals => {:feature => feature}, :layout => false}
25
32
  - if @tag_count.any?
26
- %h2 Tags
33
+ %h2 Tags (#{@tag_count.length})
27
34
  %ul
28
35
  - @tag_count.each do |tag, count|
29
36
  %li
@@ -33,5 +40,5 @@
33
40
  - if @excessive_wip_tags
34
41
  %div.alert-message.error
35
42
  %p
36
- = "You have #{@tag_count["@wip"]} @wip tags"
43
+ = "You have #{@tag_count["@wip"]} @wip tags :("
37
44
  = yield
@@ -8,7 +8,7 @@
8
8
  - @background["steps"].each do |step|
9
9
  %p
10
10
  %span.step-keyword
11
- = step["keyword"]
11
+ &= step["keyword"]
12
12
  = step["name"]
13
13
  - if @scenario["steps"]
14
14
  %h3 Steps:
@@ -16,7 +16,20 @@
16
16
  %p
17
17
  %span.step-keyword
18
18
  = step["keyword"]
19
- = step["name"]
19
+ = escape_once(step["name"])
20
20
  - else
21
21
  %p{:class => 'nosteps'}
22
22
  = "Where's Wally? This scenario has no steps!?"
23
+ - if @scenario["examples"]
24
+ %h3 Examples:
25
+ %table
26
+ - @scenario["examples"].first["rows"].each_with_index do |row, index|
27
+ %tr
28
+ - row["cells"].each do |cell|
29
+ - if index === 0
30
+ %th
31
+ = escape_once(cell)
32
+ - else
33
+ %td
34
+ = escape_once(cell)
35
+
@@ -38,5 +38,17 @@ module Wally
38
38
  "@tag3" => 1
39
39
  }
40
40
  end
41
+
42
+ it "counts feature tags irrespective of their case" do
43
+ write_feature("feature-1.feature", "@tag1\nFeature: Feature 1")
44
+ write_feature("feature-2.feature", "@TAG1\nFeature: Feature 2")
45
+ write_feature("feature-3.feature", "Feature: Feature 2\n@TAG1\nScenario: Scenario 1")
46
+ lists_features = ListsFeatures.new("application-features")
47
+
48
+ CountsTags.new(lists_features).count_tags.should == {
49
+ "@tag1" => 3
50
+ }
51
+ end
52
+
41
53
  end
42
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wally
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-24 00:00:00.000000000Z
12
+ date: 2011-11-27 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
16
- requirement: &70317088116700 !ruby/object:Gem::Requirement
16
+ requirement: &70275484147260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70317088116700
24
+ version_requirements: *70275484147260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: haml
27
- requirement: &70317088116180 !ruby/object:Gem::Requirement
27
+ requirement: &70275484146640 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70317088116180
35
+ version_requirements: *70275484146640
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rdiscount
38
- requirement: &70317088115600 !ruby/object:Gem::Requirement
38
+ requirement: &70275484145140 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70317088115600
46
+ version_requirements: *70275484145140
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: gherkin
49
- requirement: &70317088115020 !ruby/object:Gem::Requirement
49
+ requirement: &70275484144540 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70317088115020
57
+ version_requirements: *70275484144540
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: komainu
60
- requirement: &70317088114380 !ruby/object:Gem::Requirement
60
+ requirement: &70275484143720 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70317088114380
68
+ version_requirements: *70275484143720
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: cucumber
71
- requirement: &70317088113840 !ruby/object:Gem::Requirement
71
+ requirement: &70275484140820 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70317088113840
79
+ version_requirements: *70275484140820
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: capybara
82
- requirement: &70317088113300 !ruby/object:Gem::Requirement
82
+ requirement: &70275484134100 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70317088113300
90
+ version_requirements: *70275484134100
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rspec
93
- requirement: &70317088112820 !ruby/object:Gem::Requirement
93
+ requirement: &70275484133480 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70317088112820
101
+ version_requirements: *70275484133480
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: fakefs
104
- requirement: &70317088112340 !ruby/object:Gem::Requirement
104
+ requirement: &70275484132820 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70317088112340
112
+ version_requirements: *70275484132820
113
113
  description: ''
114
114
  email:
115
115
  - andrew.vos@gmail.com
@@ -131,6 +131,7 @@ files:
131
131
  - example-features/generic/multiple-scenarios.feature
132
132
  - example-features/too-many-wip-tags/too-many-wip-tags.feature
133
133
  - features/browse_features.feature
134
+ - features/counts.feature
134
135
  - features/list_tags.feature
135
136
  - features/notifications.feature
136
137
  - features/search_features.feature
@@ -186,6 +187,7 @@ specification_version: 3
186
187
  summary: ''
187
188
  test_files:
188
189
  - features/browse_features.feature
190
+ - features/counts.feature
189
191
  - features/list_tags.feature
190
192
  - features/notifications.feature
191
193
  - features/search_features.feature