stepdown 0.6.2 → 0.6.3
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.
- data/.rspec +1 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +8 -8
- data/History.txt +4 -0
- data/lib/stepdown/analyzer.rb +6 -4
- data/lib/stepdown/statistics.rb +25 -16
- data/lib/stepdown/version.rb +1 -1
- data/spec/lib/stepdown/analyzer_spec.rb +3 -1
- data/spec/lib/stepdown/statistics_spec.rb +29 -3
- data/stepdown.gemspec +2 -2
- data/templates/index.html.haml +4 -4
- metadata +6 -6
data/.rspec
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,17 +2,17 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
diff-lcs (1.1.2)
|
5
|
-
gherkin (2.
|
5
|
+
gherkin (2.4.6)
|
6
6
|
json (>= 1.4.6)
|
7
|
-
haml (3.1.
|
8
|
-
json (1.
|
9
|
-
rake (0.
|
10
|
-
rcov (0.9.
|
7
|
+
haml (3.1.2)
|
8
|
+
json (1.5.3)
|
9
|
+
rake (0.9.2)
|
10
|
+
rcov (0.9.10)
|
11
11
|
rspec (2.5.0)
|
12
12
|
rspec-core (~> 2.5.0)
|
13
13
|
rspec-expectations (~> 2.5.0)
|
14
14
|
rspec-mocks (~> 2.5.0)
|
15
|
-
rspec-core (2.5.
|
15
|
+
rspec-core (2.5.2)
|
16
16
|
rspec-expectations (2.5.0)
|
17
17
|
diff-lcs (~> 1.1.2)
|
18
18
|
rspec-mocks (2.5.0)
|
@@ -21,8 +21,8 @@ PLATFORMS
|
|
21
21
|
ruby
|
22
22
|
|
23
23
|
DEPENDENCIES
|
24
|
-
bundler (
|
25
|
-
gherkin (
|
24
|
+
bundler (> 1.0)
|
25
|
+
gherkin (> 2.3)
|
26
26
|
haml (> 2.0.0)
|
27
27
|
rake
|
28
28
|
rcov (~> 0.9.9)
|
data/History.txt
CHANGED
data/lib/stepdown/analyzer.rb
CHANGED
@@ -9,19 +9,21 @@ module Stepdown
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def analyse
|
12
|
-
|
13
|
-
scenarios = process_feature_files(feature_files)
|
14
|
-
|
15
|
-
puts "Performing analysis..." unless Stepdown.quiet
|
12
|
+
scenarios = collect_scenarios
|
16
13
|
|
17
14
|
stats = Statistics.new(scenarios, instance.step_collection)
|
15
|
+
stats.generate
|
18
16
|
|
19
17
|
reporter = reporter(@reporter, stats)
|
20
18
|
reporter.output_overview
|
21
19
|
|
22
20
|
Stepdown::YamlWriter.write(stats)
|
23
21
|
Stepdown::Graph.create_graph
|
22
|
+
end
|
24
23
|
|
24
|
+
def collect_scenarios
|
25
|
+
puts "Parsing feature files..." unless Stepdown.quiet
|
26
|
+
process_feature_files(feature_files)
|
25
27
|
end
|
26
28
|
|
27
29
|
def process_feature_files(feature_files)
|
data/lib/stepdown/statistics.rb
CHANGED
@@ -8,6 +8,15 @@ module Stepdown
|
|
8
8
|
@step_collection = step_collection
|
9
9
|
end
|
10
10
|
|
11
|
+
def generate
|
12
|
+
puts "Performing analysis..." unless Stepdown.quiet
|
13
|
+
groupings
|
14
|
+
step_usages
|
15
|
+
empty
|
16
|
+
steps_per_scenario
|
17
|
+
unique_steps
|
18
|
+
end
|
19
|
+
|
11
20
|
def to_h
|
12
21
|
stats = {}
|
13
22
|
stats[:number_scenarios] = total_scenarios
|
@@ -21,8 +30,8 @@ module Stepdown
|
|
21
30
|
groupings[10..groupings.length]
|
22
31
|
end
|
23
32
|
|
24
|
-
def
|
25
|
-
groupings[0
|
33
|
+
def groupings_top(limit = 10)
|
34
|
+
groupings[0...limit]
|
26
35
|
end
|
27
36
|
|
28
37
|
def groupings
|
@@ -38,11 +47,11 @@ module Stepdown
|
|
38
47
|
end
|
39
48
|
|
40
49
|
def steps_per_scenario
|
41
|
-
steps_scenario(@scenarios)
|
50
|
+
@steps_per_scenario ||= steps_scenario(@scenarios)
|
42
51
|
end
|
43
52
|
|
44
53
|
def unique_steps
|
45
|
-
uniq_steps_per_scenario(@scenarios)
|
54
|
+
@uniq_steps_per_scenario ||= uniq_steps_per_scenario(@scenarios)
|
46
55
|
end
|
47
56
|
|
48
57
|
def grouping(scenarios)
|
@@ -84,12 +93,12 @@ module Stepdown
|
|
84
93
|
usages.sort{|a,b| b.total_usage <=> a.total_usage}
|
85
94
|
end
|
86
95
|
|
87
|
-
def
|
88
|
-
|
96
|
+
def usages_top(limit = 10)
|
97
|
+
usages[0...limit]
|
89
98
|
end
|
90
99
|
|
91
100
|
def usages_rest
|
92
|
-
|
101
|
+
usages[10..usages.length]
|
93
102
|
end
|
94
103
|
|
95
104
|
def step_usages
|
@@ -101,19 +110,19 @@ module Stepdown
|
|
101
110
|
end
|
102
111
|
|
103
112
|
def unused_rest
|
104
|
-
|
113
|
+
unused[10..unused.length]
|
105
114
|
end
|
106
115
|
|
107
|
-
def
|
108
|
-
|
116
|
+
def unused_top(limit = 10)
|
117
|
+
unused[0...limit]
|
109
118
|
end
|
110
119
|
|
111
|
-
def
|
120
|
+
def unused
|
112
121
|
step_usages.select{|use| use.total_usage == 0}
|
113
122
|
end
|
114
123
|
|
115
124
|
def unused_step_count
|
116
|
-
|
125
|
+
unused.length
|
117
126
|
end
|
118
127
|
|
119
128
|
def uniq_steps_per_scenario(scenarios)
|
@@ -136,14 +145,14 @@ module Stepdown
|
|
136
145
|
end
|
137
146
|
|
138
147
|
def empty_rest
|
139
|
-
|
148
|
+
empty[10..empty.length]
|
140
149
|
end
|
141
150
|
|
142
|
-
def
|
143
|
-
|
151
|
+
def empty_top(limit = 10)
|
152
|
+
empty[0...limit]
|
144
153
|
end
|
145
154
|
|
146
|
-
def
|
155
|
+
def empty
|
147
156
|
@empty_scenarios ||= @scenarios.select do |scen|
|
148
157
|
scen.steps.empty?
|
149
158
|
end
|
data/lib/stepdown/version.rb
CHANGED
@@ -36,14 +36,16 @@ describe Stepdown::Analyzer do
|
|
36
36
|
features = ["awesome.txt."]
|
37
37
|
instance = mock('instance', :step_collection => [])
|
38
38
|
reporter = mock('reporter')
|
39
|
+
stats = mock('stats')
|
39
40
|
reporter.should_receive(:output_overview)
|
40
41
|
|
41
42
|
@analyzer.should_receive(:instance).and_return(instance)
|
42
43
|
@analyzer.should_receive(:feature_files).and_return(features)
|
43
44
|
@analyzer.should_receive(:process_feature_files).with(features).and_return([])
|
44
45
|
@analyzer.should_receive(:reporter).and_return(reporter)
|
46
|
+
stats.should_receive(:generate)
|
45
47
|
|
46
|
-
Stepdown::Statistics.stub!(:new).with([], instance.step_collection)
|
48
|
+
Stepdown::Statistics.stub!(:new).with([], instance.step_collection).and_return(stats)
|
47
49
|
Stepdown::YamlWriter.should_receive(:write).with(anything)
|
48
50
|
Stepdown::Graph.should_receive(:create_graph)
|
49
51
|
|
@@ -178,7 +178,7 @@ describe Stepdown::Statistics do
|
|
178
178
|
end
|
179
179
|
|
180
180
|
it "should return unused steps" do
|
181
|
-
@reporter.
|
181
|
+
@reporter.unused.should =~ [@use_3]
|
182
182
|
end
|
183
183
|
|
184
184
|
it "should return the number of unused steps" do
|
@@ -194,7 +194,7 @@ describe Stepdown::Statistics do
|
|
194
194
|
|
195
195
|
@reporter = Stepdown::Statistics.new([scen_1, scen_2], Stepdown::StepCollection.new)
|
196
196
|
|
197
|
-
@reporter.
|
197
|
+
@reporter.empty().should == [scen_1,scen_2]
|
198
198
|
end
|
199
199
|
|
200
200
|
it "should not return scenarios with steps" do
|
@@ -205,7 +205,33 @@ describe Stepdown::Statistics do
|
|
205
205
|
|
206
206
|
@reporter = Stepdown::Statistics.new([scen_1, scen_2], Stepdown::StepCollection.new)
|
207
207
|
|
208
|
-
@reporter.
|
208
|
+
@reporter.empty().should == [scen_2]
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
212
|
+
|
213
|
+
describe "report helpers" do
|
214
|
+
before :each do
|
215
|
+
@top_10 = [1,2,3,4,5,6,7,8,9,10]
|
216
|
+
@rest = [11,12]
|
217
|
+
@all = @top_10 + @rest
|
218
|
+
@stats = Stepdown::Statistics.new([], mock('step_collection'))
|
219
|
+
end
|
220
|
+
|
221
|
+
methods = ["groupings", "usages", "empty", "unused"]
|
222
|
+
|
223
|
+
methods.each do |method|
|
224
|
+
it "should return the top 10 #{method}" do
|
225
|
+
@stats.should_receive(method.to_sym).and_return(@all)
|
226
|
+
@stats.send("#{method}_top".to_sym).should eql @top_10
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
methods.each do |method|
|
231
|
+
it "should return the rest of #{method}" do
|
232
|
+
@stats.stub!(method.to_sym).and_return(@all)
|
233
|
+
@stats.send("#{method}_rest".to_sym).should eql @rest
|
234
|
+
end
|
209
235
|
end
|
210
236
|
|
211
237
|
end
|
data/stepdown.gemspec
CHANGED
@@ -16,8 +16,8 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.rubyforge_project = "stepdown"
|
17
17
|
|
18
18
|
s.add_dependency('haml', '> 2.0')
|
19
|
-
s.add_dependency('gherkin', '
|
20
|
-
s.add_dependency('bundler', '
|
19
|
+
s.add_dependency('gherkin', '> 2.3')
|
20
|
+
s.add_dependency('bundler', '> 1.0')
|
21
21
|
s.add_development_dependency('rspec', "~> 2.5.0")
|
22
22
|
s.add_development_dependency('rake')
|
23
23
|
|
data/templates/index.html.haml
CHANGED
@@ -89,7 +89,7 @@
|
|
89
89
|
%th Scenarios
|
90
90
|
%th Use per scenario
|
91
91
|
|
92
|
-
-
|
92
|
+
- usages_top(10).each do |use|
|
93
93
|
%tr
|
94
94
|
%td= use.step.regex.inspect
|
95
95
|
%td= use.total_usage
|
@@ -105,7 +105,7 @@
|
|
105
105
|
%tbody
|
106
106
|
%th Step
|
107
107
|
|
108
|
-
-
|
108
|
+
- unused_top(10).each do |use|
|
109
109
|
%tr
|
110
110
|
%td= use.step.regex.inspect
|
111
111
|
%tr
|
@@ -117,7 +117,7 @@
|
|
117
117
|
%tbody
|
118
118
|
%th Scenarios
|
119
119
|
|
120
|
-
-
|
120
|
+
- empty_top(10).each do |scen|
|
121
121
|
%tr
|
122
122
|
%td= scen.name
|
123
123
|
%tr
|
@@ -130,7 +130,7 @@
|
|
130
130
|
%th Step
|
131
131
|
%th Total step associations
|
132
132
|
|
133
|
-
-
|
133
|
+
- groupings_top(10).each_with_index do |grouping, i|
|
134
134
|
- next if grouping.use_count == 0
|
135
135
|
%tr
|
136
136
|
%td
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stepdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 3
|
10
|
+
version: 0.6.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sean Caffery
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-08-16 00:00:00 +10:00
|
19
19
|
default_executable: stepdown
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
|
-
- -
|
42
|
+
- - ">"
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
hash: 5
|
45
45
|
segments:
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
requirement: &id003 !ruby/object:Gem::Requirement
|
55
55
|
none: false
|
56
56
|
requirements:
|
57
|
-
- -
|
57
|
+
- - ">"
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
hash: 15
|
60
60
|
segments:
|