saga 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.7.0
data/lib/saga/planning.rb CHANGED
@@ -27,6 +27,16 @@ module Saga
27
27
  total
28
28
  end
29
29
 
30
+ def unestimated
31
+ unestimated = 0
32
+ @document.stories.values.each do |stories|
33
+ stories.each do |story|
34
+ unestimated += 1 unless story[:estimate]
35
+ end
36
+ end
37
+ unestimated
38
+ end
39
+
30
40
  def to_s
31
41
  if @document.empty?
32
42
  "There are no stories yet."
@@ -34,9 +44,12 @@ module Saga
34
44
  parts = iterations.keys.sort.map do |iteration|
35
45
  self.class.format_properties(iteration, iterations[iteration])
36
46
  end
37
- formatted_totals = self.class.format_properties(false, total)
38
- parts << '-'*formatted_totals.length
39
- parts << formatted_totals
47
+ unless parts.empty?
48
+ formatted_totals = self.class.format_properties(false, total)
49
+ parts << '-'*formatted_totals.length
50
+ parts << formatted_totals
51
+ end
52
+ parts << self.class.format_unestimated(unestimated) if unestimated > 0
40
53
  parts.join("\n")
41
54
  end
42
55
  end
@@ -61,5 +74,9 @@ module Saga
61
74
  story_column = (properties[:story_count] == 1) ? "#{properties[:story_count]} story" : "#{properties[:story_count]} stories"
62
75
  "#{label.ljust(14)}: #{properties[:estimate_total_in_hours]} (#{story_column})"
63
76
  end
77
+
78
+ def self.format_unestimated(unestimated)
79
+ "Unestimated : #{unestimated > 1 ? "#{unestimated} stories" : 'one story' }"
80
+ end
64
81
  end
65
82
  end
@@ -59,7 +59,7 @@ module Saga
59
59
  end
60
60
 
61
61
  def self.tokenize_story(input)
62
- parts = input.split('-')
62
+ parts = input.split(' - ')
63
63
  if parts.length > 1
64
64
  story = tokenize_story_attributes(parts[-1])
65
65
  story[:description] = parts[0..-2].join('-').strip
@@ -35,7 +35,7 @@ describe "Formatter" do
35
35
  }.should.raise(ArgumentError, "The template at path `/does/not/exist/document.erb' could not be found.")
36
36
  end
37
37
 
38
- it "omits the helpers.rb file it it doesn't exist" do
38
+ it "omits the helpers.rb file when it doesn't exist" do
39
39
  formatter = Saga::Formatter.new(@document, :template => File.expand_path('../fixtures', __FILE__))
40
40
  formatter.expects(:load).never
41
41
  formatter.format.should.not.be.empty
@@ -124,4 +124,12 @@ describe "A Parser, concerning the handling of input" do
124
124
  parser.document.definitions['Storage'].length.should == 1
125
125
  parser.document.definitions['Storage'].first[:title].should == 'Other'
126
126
  end
127
+
128
+ it "properly parses hard cases" do
129
+ parse_story_marker
130
+ parser.parse('As a member I would like the app to keep the information it got from Twitter up-to-date so that changes I make on Twitter get propagated to my listing.')
131
+
132
+ story = parser.document.stories[''].first
133
+ story[:description].should == 'As a member I would like the app to keep the information it got from Twitter up-to-date so that changes I make on Twitter get propagated to my listing.'
134
+ end
127
135
  end
@@ -11,6 +11,35 @@ describe "An empty Planning" do
11
11
  end
12
12
  end
13
13
 
14
+ describe "A Planning for unestimated stories" do
15
+ before do
16
+ @document = Saga::Document.new
17
+ @document.stories[''] = [{}, {}, {}]
18
+ @planning = Saga::Planning.new(@document)
19
+ end
20
+
21
+ it "shows a planning" do
22
+ @planning.to_s.should == "Unestimated : 3 stories"
23
+ end
24
+ end
25
+
26
+ describe "A Planning for estimated and unestimatesd stories" do
27
+ before do
28
+ @document = Saga::Document.new
29
+ @document.stories[''] = [{}, {}, {}]
30
+ @document.stories['Member'] = [{:estimate => [12, :hours]}]
31
+ @planning = Saga::Planning.new(@document)
32
+ end
33
+
34
+ it "shows a planning" do
35
+ @planning.to_s.should ==
36
+ "Unplanned : 12 (1 story)\n"+
37
+ "----------------------------\n"+
38
+ "Total : 12 (1 story)\n"+
39
+ "Unestimated : 3 stories"
40
+ end
41
+ end
42
+
14
43
  describe "A simple Planning" do
15
44
  before do
16
45
  @document = Saga::Document.new
@@ -34,6 +34,12 @@ describe "Tokenizer" do
34
34
  end
35
35
  end
36
36
 
37
+ it "tokenizes hard stories" do
38
+ Saga::Tokenizer.tokenize_story('As a member I would like the app to keep the information it got from Twitter up-to-date so that changes I make on Twitter get propagated to my listing.').should == {
39
+ :description => 'As a member I would like the app to keep the information it got from Twitter up-to-date so that changes I make on Twitter get propagated to my listing.'
40
+ }
41
+ end
42
+
37
43
  it "tokenizes definition input" do
38
44
  each_case('definition') do |input, expected|
39
45
  Saga::Tokenizer.tokenize_definition(input).should == expected
data/test/spec_helper.rb CHANGED
@@ -3,6 +3,7 @@ begin
3
3
  rescue LoadError
4
4
  end
5
5
 
6
+ require 'bacon'
6
7
  require 'mocha-on-bacon'
7
8
 
8
9
  Bacon.extend Bacon::TapOutput
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saga
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease: false
4
+ hash: 3
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
- - 6
8
+ - 7
9
9
  - 0
10
- version: 0.6.0
10
+ version: 0.7.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Manfred Stienstra
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-17 00:00:00 +01:00
18
+ date: 2011-07-04 00:00:00 +02:00
19
19
  default_executable: saga
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -72,7 +72,6 @@ extra_rdoc_files:
72
72
  - LICENSE
73
73
  - README.rdoc
74
74
  files:
75
- - .gitignore
76
75
  - .kick
77
76
  - LICENSE
78
77
  - README.rdoc
@@ -110,8 +109,8 @@ homepage: http://fingertips.github.com
110
109
  licenses: []
111
110
 
112
111
  post_install_message:
113
- rdoc_options:
114
- - --charset=UTF-8
112
+ rdoc_options: []
113
+
115
114
  require_paths:
116
115
  - lib
117
116
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -135,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
134
  requirements: []
136
135
 
137
136
  rubyforge_project:
138
- rubygems_version: 1.3.7
137
+ rubygems_version: 1.5.2
139
138
  signing_key:
140
139
  specification_version: 3
141
140
  summary: Saga is a tool to convert stories syntax to a nicely formatted document.
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- html
2
- pkg
3
- *.swp
4
- *.swo