trollolo 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -58,4 +58,8 @@ describe "create_burndown.py" do
58
58
  it "creates burndown chart with unplanned cards" do
59
59
  compare_images_for_sprint("56")
60
60
  end
61
+
62
+ it "creates burndown chart with unplanned tasks on day one" do
63
+ compare_images_for_sprint("01")
64
+ end
61
65
  end
@@ -23,10 +23,50 @@ describe Card do
23
23
  expect(@card.story_points).to eq(0.5)
24
24
  end
25
25
 
26
+ it "extracts priority number from card name" do
27
+ allow(@card).to receive(:name).and_return "(0.5) P1: Refactor cards"
28
+ expect(@card.priority).to eq(1)
29
+ end
30
+
26
31
  it "extracts story points when value is not at beginning of card name" do
27
32
  allow(@card).to receive(:name).and_return "P01: (3) Refactor cards"
28
33
  expect(@card.story_points).to eq(3)
29
34
  end
35
+
36
+ it "extracts priority number from card name if it is at the beginning " do
37
+ allow(@card).to receive(:name).and_return "P01: (3) Refactor cards"
38
+ expect(@card.priority).to eq(1)
39
+ end
40
+ end
41
+
42
+ describe "updates priority" do
43
+ before(:each) do
44
+ @card = Card.new({"cards" => [{ "id" => "mycard" }]}, "mycard")
45
+ end
46
+
47
+ it "updates existing priority in title" do
48
+ @card.name = "P01: (3) Refactor cards"
49
+ @card.priority = 3
50
+ expect(@card.name).to eq("P3: (3) Refactor cards")
51
+ end
52
+
53
+ it "adds new priority text to title" do
54
+ @card.name = "(3) Refactor cards"
55
+ @card.priority = 4
56
+ expect(@card.name).to eq("P4: (3) Refactor cards")
57
+ end
58
+
59
+ it "updates priority after story points" do
60
+ @card.name = "(0.5) P1: Refactor cards"
61
+ @card.priority = 4
62
+ expect(@card.name).to eq("(0.5) P4: Refactor cards")
63
+ end
64
+
65
+ it "adds priority after story points" do
66
+ @card.name = "(0.5) P1: Refactor cards"
67
+ @card.priority = 5
68
+ expect(@card.name).to eq("(0.5) P5: Refactor cards")
69
+ end
30
70
  end
31
71
 
32
72
  describe "#parse_yaml_from_description" do
@@ -0,0 +1,47 @@
1
+ require_relative "spec_helper"
2
+ require 'pry'
3
+
4
+ describe Prioritizer do
5
+ it "creates new prioritizer" do
6
+ prioritizer = Prioritizer.new(dummy_settings)
7
+ expect(prioritizer).to be
8
+ end
9
+
10
+ context "default" do
11
+ subject { described_class.new(dummy_settings) }
12
+
13
+ before(:each) do
14
+ full_board_mock
15
+ end
16
+
17
+ it "raises an exception if list is not on board" do
18
+ expect {
19
+ subject.prioritize("53186e8391ef8671265eba9d", "Backlog")
20
+ }.to raise_error("list not found on board")
21
+ end
22
+
23
+ it "raises an exception if list is not on board" do
24
+ RSpec::Expectations.configuration.on_potential_false_positives = :nothing
25
+ expect {
26
+ subject.prioritize("53186e8391ef8671265eba9d", "Sprint Backlog")
27
+ }.not_to raise_error("list not found on board")
28
+ end
29
+
30
+ it "adds priority text to card titles" do
31
+ [
32
+ "5319bf244cc53afd5afd991f/name?key=mykey&token=mytoken&value=P1:%20Sprint%203",
33
+ "5319c16d9d04708d450d65f1/name?key=mykey&token=mytoken&value=(3)%20P2:%20Fill%20Backlog%20column",
34
+ "5319c57ff6be845f428aa7a3/name?key=mykey&token=mytoken&value=(5)%20P3:%20Read%20data%20from%20Trollolo",
35
+ "5319c5961e530fd26f83999d/name?key=mykey&token=mytoken&value=(3)%20P4:%20Save%20read%20data%20as%20reference%20data",
36
+ "5319c5a8743488047e13fcbc/name?key=mykey&token=mytoken&value=(8)%20P5:%20Celebrate%20testing%20board",
37
+ ].each { |value|
38
+ stub_request(:put, "https://api.trello.com/1/cards/#{value}")
39
+ }
40
+
41
+ expect(STDOUT).to receive(:puts).exactly(5).times
42
+ expect {
43
+ subject.prioritize("53186e8391ef8671265eba9d", "Sprint Backlog")
44
+ }.not_to raise_error
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,18 @@
1
+ require_relative "spec_helper"
2
+ require 'pry'
3
+
4
+ describe SprintCleanup do
5
+ it "creates new sprint cleanup" do
6
+ sprint_cleanup = SprintCleanup.new(dummy_settings)
7
+ expect(sprint_cleanup).to be
8
+ end
9
+
10
+ context "default" do
11
+ subject { described_class.new(dummy_settings) }
12
+
13
+ it "moves remaining cards to target board", vcr: "sprint_cleanup", vcr_rerecord: false do
14
+ expect(STDOUT).to receive(:puts).exactly(5).times
15
+ expect(subject.cleanup("GVMQz9dx", "neUHHzDo")).to be
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,52 @@
1
+ require 'vcr'
2
+ VCR.configure do |config|
3
+ config.cassette_library_dir = "spec/data/vcr"
4
+ config.hook_into :webmock
5
+ end
6
+
7
+ # example needs to use real_settings if vcr_rerecord: true is used
8
+ def real_settings
9
+ config_path = ENV["TROLLOLO_CONFIG_PATH"] || File.expand_path("~/.trollolorc")
10
+ Settings.new(config_path)
11
+ end
12
+
13
+ def real_settings_needed?(example, subject)
14
+ example.metadata[:vcr_rerecord] && subject.instance_variable_get(:@settings).developer_public_key == 'mykey'
15
+ end
16
+
17
+ def cassette_path(cassette)
18
+ File.join(VCR.configuration.cassette_library_dir, cassette + '.yml')
19
+ end
20
+
21
+ def vcr_rerecord?(example)
22
+ example.metadata[:vcr_rerecord] && File.readable?(cassette_path(example.metadata[:vcr]))
23
+ end
24
+
25
+ def vcr_record_mode(example)
26
+ return :all if vcr_rerecord?(example)
27
+ :none
28
+ end
29
+
30
+ def vcr_replace_tokens(cassette_path)
31
+ settings = real_settings
32
+ text = File.read(cassette_path)
33
+ File.open(cassette_path, 'w') do |f|
34
+ text.gsub!(settings.member_token, 'mytoken')
35
+ text.gsub!(settings.developer_public_key, 'mykey')
36
+ f.print text
37
+ end
38
+ end
39
+
40
+ RSpec.configure do |c|
41
+ c.around do |example|
42
+ if cassette = example.metadata[:vcr]
43
+ fail "you need to use real_settings to re-record vcr data" if real_settings_needed?(example, subject)
44
+ VCR.use_cassette(cassette, record: vcr_record_mode(example)) do
45
+ example.run
46
+ end
47
+ vcr_replace_tokens(cassette_path(cassette)) if vcr_rerecord?(example)
48
+ else
49
+ example.run
50
+ end
51
+ end
52
+ end
@@ -65,8 +65,7 @@ EOT
65
65
  to_return(:status => 200, :body => card_body, :headers => {})
66
66
 
67
67
  stub_request(:post, "https://api.trello.com/1/cards/123/attachments?key=mykey&token=mytoken").
68
- with(:body => "--470924\r\nContent-Disposition: form-data; name=\"file\"; filename=\"attachment-data\"\r\nContent-Type: text/plain\r\n\r\nabc\n\r\n--470924\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\n\r\n--470924--\r\n",
69
- :headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'Content-Length'=>'188', 'Content-Type'=>'multipart/form-data; boundary=470924', 'User-Agent'=>'Ruby'}).
68
+ with(:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'Content-Length'=>'188', 'Content-Type'=>'multipart/form-data; boundary=470924', 'User-Agent'=>'Ruby'}).
70
69
  to_return(:status => 200, :body => "", :headers => {})
71
70
 
72
71
  path = given_file("attachment-data")
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.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cornelius Schumacher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-03 00:00:00.000000000 Z
11
+ date: 2016-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -66,9 +66,10 @@ files:
66
66
  - lib/checklist.rb
67
67
  - lib/cli.rb
68
68
  - lib/column.rb
69
- - lib/result.rb
69
+ - lib/prioritizer.rb
70
70
  - lib/scrum_board.rb
71
71
  - lib/settings.rb
72
+ - lib/sprint_cleanup.rb
72
73
  - lib/trello_wrapper.rb
73
74
  - lib/trollolo.rb
74
75
  - lib/version.rb
@@ -92,10 +93,14 @@ files:
92
93
  - spec/data/burndown_dir/burndown-data-02.yaml
93
94
  - spec/data/burndown_dir/create_burndown
94
95
  - spec/data/card.json
96
+ - spec/data/create_burndown_helper/burndown-01.png
95
97
  - spec/data/create_burndown_helper/burndown-08.png
96
98
  - spec/data/create_burndown_helper/burndown-23.png
97
99
  - spec/data/create_burndown_helper/burndown-31.png
98
100
  - spec/data/create_burndown_helper/burndown-35.png
101
+ - spec/data/create_burndown_helper/burndown-42.png
102
+ - spec/data/create_burndown_helper/burndown-56.png
103
+ - spec/data/create_burndown_helper/burndown-data-01.yaml
99
104
  - spec/data/create_burndown_helper/burndown-data-08.yaml
100
105
  - spec/data/create_burndown_helper/burndown-data-23.yaml
101
106
  - spec/data/create_burndown_helper/burndown-data-31.yaml
@@ -105,6 +110,7 @@ files:
105
110
  - spec/data/full-board.json
106
111
  - spec/data/lists.json
107
112
  - spec/data/trollolorc
113
+ - spec/data/vcr/sprint_cleanup.yml
108
114
  - spec/integration/command_line_spec.rb
109
115
  - spec/integration/create_burndown_spec.rb
110
116
  - spec/integration/integration_spec_helper.rb
@@ -117,12 +123,15 @@ files:
117
123
  - spec/unit/burndown_data_spec.rb
118
124
  - spec/unit/card_spec.rb
119
125
  - spec/unit/cli_spec.rb
126
+ - spec/unit/prioritizer_spec.rb
120
127
  - spec/unit/retrieve_data_spec.rb
121
128
  - spec/unit/scrum_board_spec.rb
122
129
  - spec/unit/settings_spec.rb
123
130
  - spec/unit/spec_helper.rb
131
+ - spec/unit/sprint_cleanup_spec.rb
124
132
  - spec/unit/support/test_data_operations.rb
125
133
  - spec/unit/support/update_webmock_data
134
+ - spec/unit/support/vcr.rb
126
135
  - spec/unit/support/webmocks.rb
127
136
  - spec/unit/trello_wrapper_spec.rb
128
137
  - trollolo.gemspec
data/lib/result.rb DELETED
File without changes