trollolo 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +5 -1
- data/CHANGELOG.md +29 -0
- data/Gemfile +7 -2
- data/README.md +19 -0
- data/bin/trollolo +1 -1
- data/lib/array.rb +6 -0
- data/lib/backup.rb +67 -0
- data/lib/burndown_chart.rb +96 -67
- data/lib/burndown_data.rb +62 -123
- data/lib/card.rb +74 -30
- data/lib/cli.rb +131 -9
- data/lib/column.rb +61 -0
- data/lib/result.rb +0 -0
- data/lib/scrum_board.rb +104 -0
- data/lib/settings.rb +9 -4
- data/lib/trello_wrapper.rb +62 -0
- data/lib/trollolo.rb +10 -7
- data/lib/version.rb +1 -1
- data/scripts/.gitignore +1 -0
- data/scripts/burndowndata.py +113 -0
- data/scripts/create_burndown.py +111 -146
- data/scripts/graph.py +116 -0
- data/scripts/plot.py +131 -0
- data/spec/data/board.json +63 -0
- data/spec/data/burndown-data.yaml +3 -0
- data/spec/data/burndown_dir/burndown-data-01.yaml +1 -1
- data/spec/data/burndown_dir/burndown-data-02.yaml +1 -1
- data/spec/data/card.json +61 -0
- data/spec/data/full-board.json +1626 -0
- data/spec/data/lists.json +25 -25
- data/spec/data/trollolorc +5 -0
- data/spec/{command_line_spec.rb → integration/command_line_spec.rb} +1 -4
- data/spec/integration/create_burndown_spec.rb +57 -0
- data/spec/integration/integration_spec_helper.rb +10 -0
- data/spec/integration/support/aruba_hook.rb +11 -0
- data/spec/integration/support/custom_matchers.rb +13 -0
- data/spec/{wrapper → integration/wrapper}/credentials_input_wrapper +2 -2
- data/spec/{wrapper → integration/wrapper}/empty_config_trollolo_wrapper +2 -2
- data/spec/integration/wrapper/trollolo_wrapper +10 -0
- data/spec/unit/backup_spec.rb +107 -0
- data/spec/unit/burndown_chart_spec.rb +396 -0
- data/spec/unit/burndown_data_spec.rb +118 -0
- data/spec/unit/card_spec.rb +79 -0
- data/spec/unit/cli_spec.rb +38 -0
- data/spec/unit/retrieve_data_spec.rb +54 -0
- data/spec/unit/scrum_board_spec.rb +18 -0
- data/spec/{settings_spec.rb → unit/settings_spec.rb} +1 -1
- data/spec/{spec_helper.rb → unit/spec_helper.rb} +4 -12
- data/spec/unit/support/test_data_operations.rb +7 -0
- data/spec/unit/support/update_webmock_data +17 -0
- data/spec/unit/support/webmocks.rb +52 -0
- data/spec/unit/trello_wrapper_spec.rb +47 -0
- data/trollolo.gemspec +10 -11
- metadata +54 -37
- data/lib/trello.rb +0 -66
- data/spec/burndown_chart_spec.rb +0 -307
- data/spec/burndown_data_spec.rb +0 -125
- data/spec/card_spec.rb +0 -15
- data/spec/cli_spec.rb +0 -18
- data/spec/data/cards.json +0 -1002
- data/spec/trello_spec.rb +0 -32
- data/spec/wrapper/trollolo_wrapper +0 -11
data/trollolo.gemspec
CHANGED
@@ -1,28 +1,27 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
require File.expand_path(
|
2
|
+
require File.expand_path('../lib/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
|
-
s.name =
|
5
|
+
s.name = 'trollolo'
|
6
6
|
s.version = Trollolo::VERSION
|
7
7
|
s.license = 'GPL-3'
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ['Cornelius Schumacher']
|
10
10
|
s.email = ['cschum@suse.de']
|
11
|
-
s.homepage =
|
12
|
-
s.summary =
|
13
|
-
s.description =
|
11
|
+
s.homepage = 'https://github.com/openSUSE/trollolo'
|
12
|
+
s.summary = 'Trello command line client'
|
13
|
+
s.description = 'Trollolo is a command line tool to access Trello and support tasks like generation of burndown charts.'
|
14
14
|
|
15
|
-
s.required_rubygems_version =
|
16
|
-
s.rubyforge_project =
|
15
|
+
s.required_rubygems_version = '>= 1.3.6'
|
16
|
+
s.rubyforge_project = 'trollolo'
|
17
17
|
|
18
|
-
s.add_dependency
|
18
|
+
s.add_dependency 'thor', '>= 0.19.1'
|
19
|
+
s.add_dependency 'ruby-trello', '>=1.1.2'
|
19
20
|
|
20
21
|
s.files = `git ls-files`.split("\n")
|
21
22
|
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
22
23
|
s.require_path = 'lib'
|
23
24
|
|
24
|
-
s.files += Dir['man/*.?']
|
25
|
+
s.files += Dir['man/*.?'] # UNIX man pages
|
25
26
|
s.files += Dir['man/*.{html,css,js}'] # HTML man pages
|
26
|
-
s.add_development_dependency 'ronn', '>=0.7.3'
|
27
|
-
s.add_development_dependency 'rake'
|
28
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trollolo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cornelius Schumacher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -16,42 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.19.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.19.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: ruby-trello
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
type: :
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - '>='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.7.3
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '>='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
33
|
+
version: 1.1.2
|
34
|
+
type: :runtime
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
38
|
- - '>='
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
40
|
+
version: 1.1.2
|
55
41
|
description: Trollolo is a command line tool to access Trello and support tasks like
|
56
42
|
generation of burndown charts.
|
57
43
|
email:
|
@@ -71,38 +57,69 @@ files:
|
|
71
57
|
- README.md
|
72
58
|
- Rakefile
|
73
59
|
- bin/trollolo
|
60
|
+
- examples/burndown-26.png
|
61
|
+
- lib/array.rb
|
62
|
+
- lib/backup.rb
|
74
63
|
- lib/burndown_chart.rb
|
75
64
|
- lib/burndown_data.rb
|
76
65
|
- lib/card.rb
|
77
66
|
- lib/cli.rb
|
67
|
+
- lib/column.rb
|
68
|
+
- lib/result.rb
|
69
|
+
- lib/scrum_board.rb
|
78
70
|
- lib/settings.rb
|
79
|
-
- lib/
|
71
|
+
- lib/trello_wrapper.rb
|
80
72
|
- lib/trollolo.rb
|
81
73
|
- lib/version.rb
|
82
74
|
- man/.gitignore
|
83
75
|
- man/trollolo.1.md
|
76
|
+
- scripts/.gitignore
|
77
|
+
- scripts/burndowndata.py
|
84
78
|
- scripts/create_burndown.py
|
85
|
-
-
|
86
|
-
-
|
87
|
-
- spec/
|
88
|
-
- spec/
|
89
|
-
- spec/
|
79
|
+
- scripts/graph.py
|
80
|
+
- scripts/plot.py
|
81
|
+
- spec/data/board-list.yaml
|
82
|
+
- spec/data/board.json
|
83
|
+
- spec/data/burndown-data-10.yaml
|
84
|
+
- spec/data/burndown-data-with-config.yaml
|
90
85
|
- spec/data/burndown-data.yaml
|
91
86
|
- spec/data/burndown_dir/burndown-data-01.yaml
|
92
87
|
- spec/data/burndown_dir/burndown-data-02.yaml
|
93
88
|
- spec/data/burndown_dir/create_burndown
|
94
|
-
- spec/data/
|
89
|
+
- spec/data/card.json
|
90
|
+
- spec/data/create_burndown_helper/burndown-08.png
|
91
|
+
- spec/data/create_burndown_helper/burndown-23.png
|
92
|
+
- spec/data/create_burndown_helper/burndown-31.png
|
93
|
+
- spec/data/create_burndown_helper/burndown-35.png
|
94
|
+
- spec/data/create_burndown_helper/burndown-data-08.yaml
|
95
|
+
- spec/data/create_burndown_helper/burndown-data-23.yaml
|
96
|
+
- spec/data/create_burndown_helper/burndown-data-31.yaml
|
97
|
+
- spec/data/create_burndown_helper/burndown-data-35.yaml
|
98
|
+
- spec/data/full-board.json
|
95
99
|
- spec/data/lists.json
|
96
100
|
- spec/data/trollolorc
|
97
|
-
- spec/
|
98
|
-
- spec/
|
99
|
-
- spec/
|
100
|
-
- spec/
|
101
|
-
- spec/
|
102
|
-
- spec/wrapper/
|
101
|
+
- spec/integration/command_line_spec.rb
|
102
|
+
- spec/integration/create_burndown_spec.rb
|
103
|
+
- spec/integration/integration_spec_helper.rb
|
104
|
+
- spec/integration/support/aruba_hook.rb
|
105
|
+
- spec/integration/support/custom_matchers.rb
|
106
|
+
- spec/integration/wrapper/credentials_input_wrapper
|
107
|
+
- spec/integration/wrapper/empty_config_trollolo_wrapper
|
108
|
+
- spec/integration/wrapper/trollolo_wrapper
|
109
|
+
- spec/unit/backup_spec.rb
|
110
|
+
- spec/unit/burndown_chart_spec.rb
|
111
|
+
- spec/unit/burndown_data_spec.rb
|
112
|
+
- spec/unit/card_spec.rb
|
113
|
+
- spec/unit/cli_spec.rb
|
114
|
+
- spec/unit/retrieve_data_spec.rb
|
115
|
+
- spec/unit/scrum_board_spec.rb
|
116
|
+
- spec/unit/settings_spec.rb
|
117
|
+
- spec/unit/spec_helper.rb
|
118
|
+
- spec/unit/support/test_data_operations.rb
|
119
|
+
- spec/unit/support/update_webmock_data
|
120
|
+
- spec/unit/support/webmocks.rb
|
121
|
+
- spec/unit/trello_wrapper_spec.rb
|
103
122
|
- trollolo.gemspec
|
104
|
-
- man/trollolo.1
|
105
|
-
- man/trollolo.1.html
|
106
123
|
homepage: https://github.com/openSUSE/trollolo
|
107
124
|
licenses:
|
108
125
|
- GPL-3
|
data/lib/trello.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
# Copyright (c) 2013-2014 SUSE LLC
|
2
|
-
#
|
3
|
-
# This program is free software; you can redistribute it and/or
|
4
|
-
# modify it under the terms of version 3 of the GNU General Public License as
|
5
|
-
# published by the Free Software Foundation.
|
6
|
-
#
|
7
|
-
# This program is distributed in the hope that it will be useful,
|
8
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
# GNU General Public License for more details.
|
11
|
-
#
|
12
|
-
# You should have received a copy of the GNU General Public License
|
13
|
-
# along with this program; if not, contact SUSE LLC.
|
14
|
-
#
|
15
|
-
# To contact SUSE about this file by physical or electronic mail,
|
16
|
-
# you may find current contact information at www.suse.com
|
17
|
-
|
18
|
-
class Trello
|
19
|
-
class ApiError < StandardError; end
|
20
|
-
|
21
|
-
attr_accessor :board_id
|
22
|
-
|
23
|
-
attr_reader :developer_public_key, :member_token
|
24
|
-
|
25
|
-
def initialize settings
|
26
|
-
@developer_public_key = settings.fetch(:developer_public_key)
|
27
|
-
@member_token = settings.fetch(:member_token)
|
28
|
-
@board_id = settings.fetch(:board_id)
|
29
|
-
end
|
30
|
-
|
31
|
-
def lists
|
32
|
-
get "lists"
|
33
|
-
end
|
34
|
-
|
35
|
-
def cards
|
36
|
-
get "cards"
|
37
|
-
end
|
38
|
-
|
39
|
-
def checklists
|
40
|
-
get "checklists"
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def resource_url resource
|
46
|
-
"/1/boards/#{board_id}/#{resource}?key=#{developer_public_key}&token=#{member_token}"
|
47
|
-
end
|
48
|
-
|
49
|
-
# FIXME: we should handle time-outs gracefully.
|
50
|
-
|
51
|
-
def get resource
|
52
|
-
resp = http_client.get resource_url(resource)
|
53
|
-
unless resp.code == "200"
|
54
|
-
raise ApiError.new("Error occured while connecting to the trello API.")
|
55
|
-
end
|
56
|
-
JSON.parse(resp.body)
|
57
|
-
rescue JSON::ParserError => e
|
58
|
-
raise ApiError.new(e)
|
59
|
-
end
|
60
|
-
|
61
|
-
def http_client
|
62
|
-
http = Net::HTTP.new "trello.com", 443
|
63
|
-
http.use_ssl = true
|
64
|
-
http
|
65
|
-
end
|
66
|
-
end
|
data/spec/burndown_chart_spec.rb
DELETED
@@ -1,307 +0,0 @@
|
|
1
|
-
require_relative 'spec_helper'
|
2
|
-
|
3
|
-
include GivenFilesystemSpecHelpers
|
4
|
-
|
5
|
-
describe BurndownChart do
|
6
|
-
|
7
|
-
before(:each) do
|
8
|
-
@settings = dummy_settings
|
9
|
-
@burndown_data = BurndownData.new(@settings)
|
10
|
-
@chart = BurndownChart.new(@settings)
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "initializer" do
|
14
|
-
it "sets initial meta data" do
|
15
|
-
expect(@chart.data["meta"]["sprint"]).to eq 1
|
16
|
-
expect(@chart.data["meta"]["total_days"]).to eq 10
|
17
|
-
expect(@chart.data["meta"]["weekend_lines"]).to eq [3.5, 8.5]
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe "data" do
|
22
|
-
use_given_filesystem
|
23
|
-
|
24
|
-
before(:each) do
|
25
|
-
@raw_data = [
|
26
|
-
{
|
27
|
-
"date" => '2014-04-23',
|
28
|
-
"story_points" =>
|
29
|
-
{
|
30
|
-
"total" => 30,
|
31
|
-
"open" => 23
|
32
|
-
},
|
33
|
-
"tasks" =>
|
34
|
-
{
|
35
|
-
"total" => 25,
|
36
|
-
"open" => 21
|
37
|
-
}
|
38
|
-
},
|
39
|
-
{
|
40
|
-
"date" => '2014-04-24',
|
41
|
-
"story_points" =>
|
42
|
-
{
|
43
|
-
"total" => 30,
|
44
|
-
"open" => 21
|
45
|
-
},
|
46
|
-
"tasks" =>
|
47
|
-
{
|
48
|
-
"total" => 26,
|
49
|
-
"open" => 19
|
50
|
-
},
|
51
|
-
"story_points_extra" =>
|
52
|
-
{
|
53
|
-
"done" => 3
|
54
|
-
},
|
55
|
-
"tasks_extra" =>
|
56
|
-
{
|
57
|
-
"done" => 2
|
58
|
-
}
|
59
|
-
}
|
60
|
-
]
|
61
|
-
end
|
62
|
-
|
63
|
-
it "creates first data entry" do
|
64
|
-
@burndown_data.story_points.open = 16
|
65
|
-
@burndown_data.story_points.done = 7
|
66
|
-
@burndown_data.tasks.open = 10
|
67
|
-
@burndown_data.tasks.done = 11
|
68
|
-
|
69
|
-
@chart.add_data(@burndown_data,Date.parse("2014-05-30"))
|
70
|
-
|
71
|
-
expect( @chart.data["days"].first["story_points"] ).to eq(
|
72
|
-
{
|
73
|
-
"total" => 23,
|
74
|
-
"open" => 16
|
75
|
-
} )
|
76
|
-
expect( @chart.data["days"].first["tasks"] ).to eq(
|
77
|
-
{
|
78
|
-
"total" => 21,
|
79
|
-
"open" => 10
|
80
|
-
} )
|
81
|
-
end
|
82
|
-
|
83
|
-
it "returns sprint number" do
|
84
|
-
expect(@chart.sprint).to eq 1
|
85
|
-
end
|
86
|
-
|
87
|
-
it "adds data" do
|
88
|
-
@chart.data["days"] = @raw_data
|
89
|
-
|
90
|
-
@burndown_data.story_points.open = 16
|
91
|
-
@burndown_data.story_points.done = 7
|
92
|
-
@burndown_data.tasks.open = 10
|
93
|
-
@burndown_data.tasks.done = 11
|
94
|
-
@burndown_data.extra_story_points.open = 2
|
95
|
-
@burndown_data.extra_story_points.done = 3
|
96
|
-
@burndown_data.extra_tasks.open = 5
|
97
|
-
@burndown_data.extra_tasks.done = 2
|
98
|
-
|
99
|
-
@chart.add_data(@burndown_data,Date.parse("2014-05-30"))
|
100
|
-
|
101
|
-
expect( @chart.data["days"].count ).to eq 3
|
102
|
-
expect( @chart.data["days"].last["date"] ).to eq ( "2014-05-30" )
|
103
|
-
expect( @chart.data["days"].last["story_points"] ).to eq ( {
|
104
|
-
"total" => 23,
|
105
|
-
"open" => 16
|
106
|
-
} )
|
107
|
-
expect( @chart.data["days"].last["tasks"] ).to eq ( {
|
108
|
-
"total" => 21,
|
109
|
-
"open" => 10
|
110
|
-
} )
|
111
|
-
expect( @chart.data["days"].last["story_points_extra"] ).to eq ( {
|
112
|
-
"done" => 3
|
113
|
-
} )
|
114
|
-
expect( @chart.data["days"].last["tasks_extra"] ).to eq ( {
|
115
|
-
"done" => 2
|
116
|
-
} )
|
117
|
-
end
|
118
|
-
|
119
|
-
it "replaces data of same day" do
|
120
|
-
@chart.data["days"] = @raw_data
|
121
|
-
|
122
|
-
@burndown_data.story_points.open = 16
|
123
|
-
@burndown_data.story_points.done = 7
|
124
|
-
@burndown_data.tasks.open = 10
|
125
|
-
@burndown_data.tasks.done = 11
|
126
|
-
|
127
|
-
@chart.add_data(@burndown_data,Date.parse("2014-05-30"))
|
128
|
-
|
129
|
-
expect( @chart.data["days"].count ).to eq 3
|
130
|
-
expect( @chart.data["days"].last["story_points"] ).to eq ( {
|
131
|
-
"total" => 23,
|
132
|
-
"open" => 16
|
133
|
-
} )
|
134
|
-
|
135
|
-
@burndown_data.story_points.done = 8
|
136
|
-
@chart.add_data(@burndown_data,Date.parse("2014-05-30"))
|
137
|
-
|
138
|
-
expect( @chart.data["days"].count ).to eq 3
|
139
|
-
expect( @chart.data["days"].last["story_points"] ).to eq ( {
|
140
|
-
"total" => 24,
|
141
|
-
"open" => 16
|
142
|
-
} )
|
143
|
-
end
|
144
|
-
|
145
|
-
it "reads data" do
|
146
|
-
@chart.read_data given_file('burndown-data.yaml')
|
147
|
-
|
148
|
-
expect(@chart.data["days"]).to eq @raw_data
|
149
|
-
end
|
150
|
-
|
151
|
-
it "writes data" do
|
152
|
-
read_path = given_file('burndown-data.yaml')
|
153
|
-
@chart.read_data(read_path)
|
154
|
-
|
155
|
-
write_path = given_dummy_file
|
156
|
-
@chart.write_data(write_path)
|
157
|
-
|
158
|
-
expect(File.read(write_path)).to eq File.read(read_path)
|
159
|
-
end
|
160
|
-
|
161
|
-
it "doesn't write extra entries with 0 values" do
|
162
|
-
raw_data = [
|
163
|
-
{
|
164
|
-
"date" => '2014-04-24',
|
165
|
-
"story_points" =>
|
166
|
-
{
|
167
|
-
"total" => 30,
|
168
|
-
"open" => 21
|
169
|
-
},
|
170
|
-
"tasks" =>
|
171
|
-
{
|
172
|
-
"total" => 26,
|
173
|
-
"open" => 19
|
174
|
-
},
|
175
|
-
"story_points_extra" =>
|
176
|
-
{
|
177
|
-
"done" => 0
|
178
|
-
},
|
179
|
-
"tasks_extra" =>
|
180
|
-
{
|
181
|
-
"done" => 0
|
182
|
-
}
|
183
|
-
}
|
184
|
-
]
|
185
|
-
@chart.data["days"] = raw_data
|
186
|
-
@chart.data["meta"]["board_id"] = "1234"
|
187
|
-
|
188
|
-
write_path = given_dummy_file
|
189
|
-
@chart.write_data(write_path)
|
190
|
-
|
191
|
-
expected_file_content = <<EOT
|
192
|
-
---
|
193
|
-
meta:
|
194
|
-
board_id: '1234'
|
195
|
-
sprint: 1
|
196
|
-
total_days: 10
|
197
|
-
weekend_lines:
|
198
|
-
- 3.5
|
199
|
-
- 8.5
|
200
|
-
days:
|
201
|
-
- date: '2014-04-24'
|
202
|
-
story_points:
|
203
|
-
total: 30
|
204
|
-
open: 21
|
205
|
-
tasks:
|
206
|
-
total: 26
|
207
|
-
open: 19
|
208
|
-
EOT
|
209
|
-
expect(File.read(write_path)).to eq expected_file_content
|
210
|
-
end
|
211
|
-
|
212
|
-
end
|
213
|
-
|
214
|
-
describe "commands" do
|
215
|
-
use_given_filesystem(keep_files: true)
|
216
|
-
|
217
|
-
describe "setup" do
|
218
|
-
it "initializes new chart" do
|
219
|
-
path = given_directory
|
220
|
-
@chart.setup(path,"myboardid")
|
221
|
-
|
222
|
-
expect(File.exist?(File.join(path,"burndown-data-01.yaml"))).to be true
|
223
|
-
|
224
|
-
chart = BurndownChart.new(@settings)
|
225
|
-
chart.read_data(File.join(path,"burndown-data-01.yaml"))
|
226
|
-
|
227
|
-
expect(chart.board_id).to eq "myboardid"
|
228
|
-
end
|
229
|
-
end
|
230
|
-
|
231
|
-
describe "update" do
|
232
|
-
it "updates chart with latest data" do
|
233
|
-
card_url_match = /https:\/\/trello.com\/1\/boards\/myboardid\/cards\?-*/
|
234
|
-
|
235
|
-
stub_request(:any,card_url_match).to_return(:status => 200,
|
236
|
-
:body => load_test_file("cards.json"), :headers => {})
|
237
|
-
|
238
|
-
list_url_match = /https:\/\/trello.com\/1\/boards\/myboardid\/lists\?-*/
|
239
|
-
|
240
|
-
stub_request(:any,list_url_match).to_return(:status => 200,
|
241
|
-
:body => load_test_file("lists.json"), :headers => {})
|
242
|
-
|
243
|
-
path = given_directory_from_data("burndown_dir")
|
244
|
-
|
245
|
-
before = BurndownChart.new(@settings)
|
246
|
-
before.read_data(File.join(path,'burndown-data-02.yaml'))
|
247
|
-
|
248
|
-
@chart.update(path)
|
249
|
-
|
250
|
-
after = BurndownChart.new(@settings)
|
251
|
-
after.read_data(File.join(path,'burndown-data-02.yaml'))
|
252
|
-
|
253
|
-
expect(after.days.size).to eq before.days.size + 1
|
254
|
-
end
|
255
|
-
|
256
|
-
it "overwrites data on same date" do
|
257
|
-
card_url_match = /https:\/\/trello.com\/1\/boards\/myboardid\/cards\?-*/
|
258
|
-
|
259
|
-
stub_request(:any,card_url_match).to_return(:status => 200,
|
260
|
-
:body => load_test_file("cards.json"), :headers => {})
|
261
|
-
|
262
|
-
list_url_match = /https:\/\/trello.com\/1\/boards\/myboardid\/lists\?-*/
|
263
|
-
|
264
|
-
stub_request(:any,list_url_match).to_return(:status => 200,
|
265
|
-
:body => load_test_file("lists.json"), :headers => {})
|
266
|
-
|
267
|
-
path = given_directory_from_data("burndown_dir")
|
268
|
-
|
269
|
-
before = BurndownChart.new(@settings)
|
270
|
-
before.read_data(File.join(path,'burndown-data-02.yaml'))
|
271
|
-
|
272
|
-
@chart.update(path)
|
273
|
-
@chart.update(path)
|
274
|
-
|
275
|
-
after = BurndownChart.new(@settings)
|
276
|
-
after.read_data(File.join(path,'burndown-data-02.yaml'))
|
277
|
-
|
278
|
-
expect(after.days.size).to eq before.days.size + 1
|
279
|
-
end
|
280
|
-
end
|
281
|
-
|
282
|
-
describe "create_next_sprint" do
|
283
|
-
it "create new sprint file" do
|
284
|
-
path = given_directory_from_data("burndown_dir")
|
285
|
-
chart = BurndownChart.new(@settings)
|
286
|
-
chart.create_next_sprint(path)
|
287
|
-
|
288
|
-
next_sprint_file = File.join(path, "burndown-data-03.yaml")
|
289
|
-
expect(File.exist?(next_sprint_file)).to be true
|
290
|
-
|
291
|
-
expected_file_content = <<EOT
|
292
|
-
---
|
293
|
-
meta:
|
294
|
-
board_id: myboardid
|
295
|
-
sprint: 3
|
296
|
-
total_days: 9
|
297
|
-
weekend_lines:
|
298
|
-
- 3.5
|
299
|
-
- 7.5
|
300
|
-
days: []
|
301
|
-
EOT
|
302
|
-
expect(File.read(next_sprint_file)).to eq expected_file_content
|
303
|
-
end
|
304
|
-
end
|
305
|
-
end
|
306
|
-
|
307
|
-
end
|