redpomo 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,102 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://code.welaika.com/users/current.json?key=WELAIKA_TOKEN
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ User-Agent:
17
+ - Ruby
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Date:
24
+ - Sun, 13 May 2012 15:49:32 GMT
25
+ Server:
26
+ - Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny9 with Suhosin-Patch mod_ssl/2.2.9
27
+ OpenSSL/0.9.8g Phusion_Passenger/3.0.0
28
+ X-Powered-By:
29
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.0
30
+ Etag:
31
+ - ! '"210f37abc00e2352ce9a7ebfc82e684d"'
32
+ X-Runtime:
33
+ - '48'
34
+ Cache-Control:
35
+ - private, max-age=0, must-revalidate
36
+ Content-Length:
37
+ - '196'
38
+ Status:
39
+ - '200'
40
+ Content-Type:
41
+ - application/json; charset=utf-8
42
+ body:
43
+ encoding: US-ASCII
44
+ string: ! '{"user":{"mail":"stefano.verna@welaika.com","last_login_on":"2012/05/13
45
+ 11:17:28 +0200","lastname":"Verna","login":"steffoz","created_on":"2010/02/11
46
+ 09:34:28 +0100","firstname":"Stefano","id":4}}'
47
+ http_version:
48
+ recorded_at: Sun, 13 May 2012 15:49:33 GMT
49
+ - request:
50
+ method: post
51
+ uri: http://code.welaika.com/issues.json?key=WELAIKA_TOKEN
52
+ body:
53
+ encoding: UTF-8
54
+ string: ! '{"issue":{"subject":"foobar","description":null,"due_date":null,"project_id":"olasagasti","priority_id":4,"assigned_to_id":4}}'
55
+ headers:
56
+ Accept:
57
+ - application/json
58
+ Accept-Encoding:
59
+ - gzip, deflate
60
+ Content-Type:
61
+ - application/json
62
+ Content-Length:
63
+ - '126'
64
+ User-Agent:
65
+ - Ruby
66
+ response:
67
+ status:
68
+ code: 201
69
+ message: Created
70
+ headers:
71
+ Date:
72
+ - Sun, 13 May 2012 15:49:33 GMT
73
+ Server:
74
+ - Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny9 with Suhosin-Patch mod_ssl/2.2.9
75
+ OpenSSL/0.9.8g Phusion_Passenger/3.0.0
76
+ X-Powered-By:
77
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.0
78
+ X-Runtime:
79
+ - '288'
80
+ Cache-Control:
81
+ - no-cache
82
+ Set-Cookie:
83
+ - _redmine_session=BAh7BzoPc2Vzc2lvbl9pZCIlMGE5Y2M5NGZmNjRiYjA4NjE2MTY1MDk3ZDE2MmUzN2IiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7BjoLbm90aWNlIhpDcmVhemlvbmUgZWZmZXR0dWF0YS4GOgpAdXNlZHsGOwdG--4f2ec2b1d5f84985b5475828990ec5b42bdd9c17;
84
+ path=/; HttpOnly
85
+ Location:
86
+ - http://code.welaika.com/issues/3397
87
+ Content-Length:
88
+ - '408'
89
+ Status:
90
+ - '201'
91
+ Content-Type:
92
+ - application/json; charset=utf-8
93
+ body:
94
+ encoding: US-ASCII
95
+ string: ! '{"issue":{"status":{"name":"New","id":1},"updated_on":"2012/05/13
96
+ 17:49:33 +0200","assigned_to":{"name":"Stefano Verna","id":4},"done_ratio":0,"tracker":{"name":"Bug","id":1},"start_date":"2012/05/13","created_on":"2012/05/13
97
+ 17:49:33 +0200","spent_hours":0.0,"subject":"foobar","author":{"name":"Stefano
98
+ Verna","id":4},"id":3397,"priority":{"name":"Normal","id":4},"project":{"name":"Olasagasti
99
+ ","id":52}}}'
100
+ http_version:
101
+ recorded_at: Sun, 13 May 2012 15:49:33 GMT
102
+ recorded_with: VCR 2.0.1
@@ -2,10 +2,10 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: put
5
- uri: https://project.cantierecreativo.net/issues/838.json?key=CANTIERE_TOKEN
5
+ uri: http://code.welaika.com/issues/3290.json?key=WELAIKA_TOKEN
6
6
  body:
7
7
  encoding: UTF-8
8
- string: ! '{"issue":{"status_id":5}}'
8
+ string: ! '{"issue":{"status_id":5,"notes":"bar"}}'
9
9
  headers:
10
10
  Accept:
11
11
  - application/json
@@ -14,7 +14,7 @@ http_interactions:
14
14
  Content-Type:
15
15
  - application/json
16
16
  Content-Length:
17
- - '25'
17
+ - '39'
18
18
  User-Agent:
19
19
  - Ruby
20
20
  response:
@@ -23,20 +23,19 @@ http_interactions:
23
23
  message: OK
24
24
  headers:
25
25
  Date:
26
- - Sat, 05 May 2012 12:50:41 GMT
26
+ - Sun, 13 May 2012 15:23:49 GMT
27
27
  Server:
28
- - Apache/2.2.9 (Debian) DAV/2 PHP/5.2.6-1+lenny10 with Suhosin-Patch mod_python/3.3.1
29
- Python/2.5.2 mod_ssl/2.2.9 OpenSSL/0.9.8g Phusion_Passenger/3.0.0
28
+ - Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny9 with Suhosin-Patch mod_ssl/2.2.9
29
+ OpenSSL/0.9.8g Phusion_Passenger/3.0.0
30
30
  X-Powered-By:
31
31
  - Phusion Passenger (mod_rails/mod_rack) 3.0.0
32
32
  X-Runtime:
33
- - '2868'
33
+ - '120'
34
34
  Cache-Control:
35
35
  - no-cache
36
36
  Set-Cookie:
37
- - _redmine_session=BAh7BzoPc2Vzc2lvbl9pZCIlYTRjNzRjYzVmMDllNDJmYTNlMzU0NmEwMWQwYTEwYzUiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7BjoLbm90aWNlIhlNb2RpZmljYSBlZmZldHR1YXRhLgY6CkB1c2VkewY7B0Y%3D--1337564c1bf1f5b34c2a505039c279d6f7074532;
37
+ - _redmine_session=BAh7BzoPc2Vzc2lvbl9pZCIlMzFkMDkyZDBkZDFjYjA3YjgyYjY1MTU1ZGQ0MmIzNTkiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7BjoLbm90aWNlIhlNb2RpZmljYSBlZmZldHR1YXRhLgY6CkB1c2VkewY7B0Y%3D--81bc19aea06cf94b7f7703393d43f792b17fcde0;
38
38
  path=/; HttpOnly
39
- - autologin=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT
40
39
  Content-Length:
41
40
  - '1'
42
41
  Status:
@@ -46,6 +45,6 @@ http_interactions:
46
45
  body:
47
46
  encoding: US-ASCII
48
47
  string: ! ' '
49
- http_version:
50
- recorded_at: Sat, 05 May 2012 12:50:46 GMT
48
+ http_version:
49
+ recorded_at: Sun, 13 May 2012 15:23:49 GMT
51
50
  recorded_with: VCR 2.0.1
@@ -0,0 +1,102 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://code.welaika.com/users/current.json?key=WELAIKA_TOKEN
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ User-Agent:
17
+ - Ruby
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Date:
24
+ - Sun, 13 May 2012 12:36:06 GMT
25
+ Server:
26
+ - Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny9 with Suhosin-Patch mod_ssl/2.2.9
27
+ OpenSSL/0.9.8g Phusion_Passenger/3.0.0
28
+ X-Powered-By:
29
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.0
30
+ Etag:
31
+ - ! '"210f37abc00e2352ce9a7ebfc82e684d"'
32
+ X-Runtime:
33
+ - '212'
34
+ Cache-Control:
35
+ - private, max-age=0, must-revalidate
36
+ Content-Length:
37
+ - '196'
38
+ Status:
39
+ - '200'
40
+ Content-Type:
41
+ - application/json; charset=utf-8
42
+ body:
43
+ encoding: US-ASCII
44
+ string: ! '{"user":{"mail":"stefano.verna@welaika.com","last_login_on":"2012/05/13
45
+ 11:17:28 +0200","lastname":"Verna","login":"steffoz","created_on":"2010/02/11
46
+ 09:34:28 +0100","firstname":"Stefano","id":4}}'
47
+ http_version:
48
+ recorded_at: Sun, 13 May 2012 12:36:07 GMT
49
+ - request:
50
+ method: post
51
+ uri: http://code.welaika.com/issues.json?key=WELAIKA_TOKEN
52
+ body:
53
+ encoding: UTF-8
54
+ string: ! '{"issue":{"subject":"foo","description":"bar","due_date":"2012-12-01","project_id":"olasagasti","priority_id":5,"assigned_to_id":4}}'
55
+ headers:
56
+ Accept:
57
+ - application/json
58
+ Accept-Encoding:
59
+ - gzip, deflate
60
+ Content-Type:
61
+ - application/json
62
+ Content-Length:
63
+ - '132'
64
+ User-Agent:
65
+ - Ruby
66
+ response:
67
+ status:
68
+ code: 201
69
+ message: Created
70
+ headers:
71
+ Date:
72
+ - Sun, 13 May 2012 12:36:07 GMT
73
+ Server:
74
+ - Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny9 with Suhosin-Patch mod_ssl/2.2.9
75
+ OpenSSL/0.9.8g Phusion_Passenger/3.0.0
76
+ X-Powered-By:
77
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.0
78
+ X-Runtime:
79
+ - '124'
80
+ Cache-Control:
81
+ - no-cache
82
+ Set-Cookie:
83
+ - _redmine_session=BAh7BzoPc2Vzc2lvbl9pZCIlYzJiNzBmNmU4NmVjNjY3NmZjNDcyOTgxYzMxMWE5OGQiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7BjoLbm90aWNlIhpDcmVhemlvbmUgZWZmZXR0dWF0YS4GOgpAdXNlZHsGOwdG--a60050631dc0708324a571c42a5577b94471e05e;
84
+ path=/; HttpOnly
85
+ Location:
86
+ - http://code.welaika.com/issues/3395
87
+ Content-Length:
88
+ - '447'
89
+ Status:
90
+ - '201'
91
+ Content-Type:
92
+ - application/json; charset=utf-8
93
+ body:
94
+ encoding: US-ASCII
95
+ string: ! '{"issue":{"status":{"name":"New","id":1},"updated_on":"2012/05/13
96
+ 14:36:07 +0200","due_date":"2012/12/01","assigned_to":{"name":"Stefano Verna","id":4},"done_ratio":0,"description":"bar","tracker":{"name":"Bug","id":1},"start_date":"2012/05/13","created_on":"2012/05/13
97
+ 14:36:07 +0200","spent_hours":0.0,"subject":"foo","author":{"name":"Stefano
98
+ Verna","id":4},"id":3395,"priority":{"name":"High","id":5},"project":{"name":"Olasagasti
99
+ ","id":52}}}'
100
+ http_version:
101
+ recorded_at: Sun, 13 May 2012 12:36:08 GMT
102
+ recorded_with: VCR 2.0.1
@@ -0,0 +1,55 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://code.welaika.com/time_entries.json?key=WELAIKA_TOKEN
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"time_entry":{"issue_id":3392,"spent_on":"2012-01-01","hours":0.001388888888888889,"comments":"Foobar"}}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ Content-Length:
17
+ - '105'
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: Created
24
+ headers:
25
+ Date:
26
+ - Sun, 13 May 2012 12:27:38 GMT
27
+ Server:
28
+ - Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny9 with Suhosin-Patch mod_ssl/2.2.9
29
+ OpenSSL/0.9.8g Phusion_Passenger/3.0.0
30
+ X-Powered-By:
31
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.0
32
+ X-Runtime:
33
+ - '80'
34
+ Cache-Control:
35
+ - no-cache
36
+ Set-Cookie:
37
+ - _redmine_session=BAh7BjoPc2Vzc2lvbl9pZCIlZmVlOTJlNzQ0NDQxZmQ1YjBhYzJhZDhlMmVkYjc3ODY%3D--be9fdcbbc0ed25d715650a2684f1a590641636a4;
38
+ path=/; HttpOnly
39
+ Location:
40
+ - http://code.welaika.com/time_entries/4015
41
+ Content-Length:
42
+ - '321'
43
+ Status:
44
+ - '201'
45
+ Content-Type:
46
+ - application/json; charset=utf-8
47
+ body:
48
+ encoding: US-ASCII
49
+ string: ! '{"time_entry":{"spent_on":"2012/01/01","updated_on":"2012/05/13 14:27:38
50
+ +0200","activity":{"name":"Development","id":9},"user":{"name":"Stefano Verna","id":4},"created_on":"2012/05/13
51
+ 14:27:38 +0200","hours":0.00138888888888889,"comments":"Foobar","issue":{"id":3392},"id":4015,"project":{"name":"Olasagasti
52
+ ","id":52}}}'
53
+ http_version:
54
+ recorded_at: Sun, 13 May 2012 12:27:38 GMT
55
+ recorded_with: VCR 2.0.1
@@ -1,2 +1,2 @@
1
- Fix #3290 @welaika
1
+ Make screenshot #838 @cantiere
2
2
  Another task @home
@@ -0,0 +1,16 @@
1
+ cache: false
2
+ trackers:
3
+ cantiere:
4
+ url: "https://project.cantierecreativo.net"
5
+ token: "CANTIERE_TOKEN"
6
+ default_project_id: "cc"
7
+ closed_status_id: 5
8
+ default_priority_id: 4
9
+ priority_ids: [ 16, 6, 5 ]
10
+ welaika:
11
+ url: "http://code.welaika.com"
12
+ token: "WELAIKA_TOKEN"
13
+ default_project_id: "welaika"
14
+ closed_status_id: 5
15
+ default_priority_id: 4
16
+ priority_ids: [ 7, 6, 5 ]
@@ -4,14 +4,14 @@ gestione utenti #987 +giunti-web @cantiere
4
4
  Documentazione server su Wiki #986 +giunti-web @cantiere
5
5
  Form richiesta kit #985 +giunti-web @cantiere
6
6
  Invia libro ad un amico #976 +giunti-web @cantiere
7
- Immagini promo per chrome 2012-04-04 #859 +zazit @cantiere
8
- Correzioni frase e logo zazit 2012-04-04 #858 +zazit @cantiere
9
- icone per safari 2012-04-02 #839 +zazit @cantiere
10
- icona per chrome market 2012-04-02 #837 +zazit @cantiere
7
+ 2012-04-04 Immagini promo per chrome #859 +zazit @cantiere
8
+ (C) 2012-04-04 Correzioni frase e logo zazit #858 +zazit @cantiere
9
+ (B) 2012-04-02 icone per safari #839 +zazit @cantiere
10
+ (B) 2012-04-02 icona per chrome market #837 +zazit @cantiere
11
11
  Rel Canonical e rel author #820 +railsyard @cantiere
12
12
  DSL backend per la gestione dei model #731 +railsyard @cantiere
13
13
  paradosso zazit #728 +zazit @cantiere
14
- New Users iOS #3316 +dashboard-fiat @welaika
14
+ (B) New Users iOS #3316 +dashboard-fiat @welaika
15
15
  Orlando Locator #3296 +olasagasti @welaika
16
16
  Il Paniere #3295 +olasagasti @welaika
17
17
  Scheda Prodotto #3294 +olasagasti @welaika
@@ -0,0 +1,3 @@
1
+ Make screenshot #838 @cantiere
2
+ Fix #3290 @welaika
3
+ Another task @home
@@ -0,0 +1,38 @@
1
+ require 'tempfile'
2
+ require 'spec_helper'
3
+
4
+ describe "redpomo init" do
5
+
6
+ let(:config_path) {
7
+ new_config = Tempfile.new('redpomo')
8
+ new_config_path = new_config.path
9
+ new_config.unlink
10
+ new_config_path
11
+ }
12
+
13
+ it "generates a .redpomo config file" do
14
+ redpomo "init #{config_path}", env: { "EDITOR" => "echo editor" }
15
+ File.exists?(config_path).should be_true
16
+ end
17
+
18
+ it "opens the config with REDPOMO_EDITOR as highest priority" do
19
+ redpomo "init #{config_path}", :env => {"EDITOR" => "echo editor", "VISUAL" => "echo visual", "REDPOMO_EDITOR" => "echo redpomo_editor"}
20
+ out.should == "redpomo_editor #{config_path}"
21
+ end
22
+
23
+ it "opens the config with VISUAL as 2nd highest priority" do
24
+ redpomo "init #{config_path}", :env => {"EDITOR" => "echo editor", "VISUAL" => "echo visual", "REDPOMO_EDITOR" => ""}
25
+ out.should == "visual #{config_path}"
26
+ end
27
+
28
+ it "opens the config with EDITOR as 3rd highest priority" do
29
+ redpomo "init #{config_path}", :env => {"EDITOR" => "echo editor", "VISUAL" => "", "REDPOMO_EDITOR" => ""}
30
+ out.should == "editor #{config_path}"
31
+ end
32
+
33
+ it "complains if no EDITOR is set" do
34
+ redpomo "init #{config_path}", :env => {"EDITOR" => "", "VISUAL" => "", "REDPOMO_EDITOR" => ""}
35
+ out.should == "To open the .redpomo config file, set $EDITOR or $REDPOMO_EDITOR"
36
+ end
37
+
38
+ end
@@ -1,67 +1,41 @@
1
1
  require 'spec_helper'
2
- require 'tempfile'
3
2
  require 'launchy'
4
3
  require 'applescript'
5
4
  require 'redpomo/cli'
5
+ require 'fileutils'
6
6
 
7
7
  describe Redpomo::CLI do
8
8
 
9
- let(:todo_tasks) do
10
- [
11
- "Make screenshot #838 @cantiere",
12
- "Fix #3290 @welaika",
13
- "Another task @home"
14
- ]
15
- end
16
-
17
- let(:todo_file) do
18
- Tempfile.new('todo')
19
- end
9
+ let(:todo_path) {
10
+ file = File.open(tmp('tasks.txt'), 'w')
11
+ file.write read_fixture("tasks.txt")
12
+ file.close
13
+ file.path
14
+ }
20
15
 
21
- let(:config) do
22
- {
23
- "todo" => todo_file.path,
24
- "cache" => false,
25
- "trackers" => {
26
- "cantiere" => {
27
- "url" => "https://project.cantierecreativo.net",
28
- "token" => "CANTIERE_TOKEN",
29
- "default_project" => "cc",
30
- "closed_status" => 5
31
- },
32
- "welaika" => {
33
- "url" => "http://code.welaika.com",
34
- "token" => "WELAIKA_TOKEN",
35
- "default_project" => "welaika",
36
- "closed_status" => 5
37
- }
38
- }
39
- }
40
- end
41
-
42
- let(:config_file) do
43
- Tempfile.new('config')
44
- end
16
+ let(:config_path) {
17
+ config = YAML::load_file fixture("config.yml")
18
+ config["todo"] = todo_path
19
+ file = File.open(tmp('config.yml'), 'w')
20
+ file.write config.to_yaml
21
+ file.close
22
+ file.path
23
+ }
45
24
 
46
- before(:each) do
47
- todo_file.write(todo_tasks.join("\n"))
48
- todo_file.close
49
- config_file.write(config.to_yaml)
50
- config_file.close
51
- end
52
-
53
- after(:each) do
54
- todo_file.unlink
55
- config_file.unlink
25
+ describe "push LOG" do
26
+ it "pushes the specified timelog to remote trackers" do
27
+ VCR.use_cassette('cli_push') do
28
+ cli_redpomo "push #{fixture("timelog.csv")}"
29
+ out.strip.should == "Pushed 2 time entries!"
30
+ end
31
+ end
56
32
  end
57
33
 
58
- describe "push LOG" do
34
+ describe "push -n LOG" do
59
35
  it "pushes the specified timelog to remote trackers" do
60
36
  VCR.use_cassette('cli_push') do
61
- output = capture(:stdout) do
62
- Redpomo::CLI.start("push spec/fixtures/timelog.csv --config #{config_file.path}".split)
63
- end
64
- output.should == File.read("spec/fixtures/printer_output.txt")
37
+ cli_redpomo "push -n #{fixture("timelog.csv")}"
38
+ out.should == read_fixture("printer_output.txt")
65
39
  end
66
40
  end
67
41
  end
@@ -69,22 +43,23 @@ describe Redpomo::CLI do
69
43
  describe "start ISSUE" do
70
44
  it "starts the specified issue on Pomodoro.app" do
71
45
  AppleScript.expects(:execute).with('tell application "Pomodoro" to start "Make screenshot #838 @cantiere"')
72
- Redpomo::CLI.start("start 1 --config #{config_file.path}".split)
46
+ cli_redpomo "start 1"
73
47
  end
74
48
  end
75
49
 
76
50
  describe "open ISSUE" do
77
51
  it "shows the specified issue on the browser" do
78
52
  Launchy.expects(:open).with('https://project.cantierecreativo.net/issues/838')
79
- Redpomo::CLI.start("open 1 --config #{config_file.path}".split)
53
+ cli_redpomo "open 1"
80
54
  end
81
55
  end
82
56
 
83
57
  describe "close ISSUE" do
84
58
  it "closes issue on remote tracker and marks current task as done" do
85
59
  VCR.use_cassette('cli_close') do
86
- Redpomo::CLI.start("close 1 --config #{config_file.path}".split)
87
- File.read(todo_file.path).should == File.read("spec/fixtures/close_results.txt")
60
+ cli_redpomo "close 2 -m bar"
61
+ File.read(todo_path).should == read_fixture("close_results.txt")
62
+ out.strip.should == 'Issue updated, see it at http://code.welaika.com/issues/3290'
88
63
  end
89
64
  end
90
65
  end
@@ -92,12 +67,25 @@ describe Redpomo::CLI do
92
67
  describe "pull" do
93
68
  it "fetches all the trackers and converts the issues in todo tasks" do
94
69
  VCR.use_cassette('cli_pull') do
95
- Redpomo::CLI.start("pull --config #{config_file.path}".split)
96
- File.read(todo_file.path).should == File.read("spec/fixtures/pull_results.txt")
70
+ cli_redpomo "pull"
71
+ File.read(todo_path).should == read_fixture("pull_results.txt")
72
+ end
73
+ end
74
+ end
75
+
76
+ describe "add" do
77
+ it "creates a new task, adds it the list, and pushes it to the tracker" do
78
+ VCR.use_cassette('cli_add') do
79
+ cli_redpomo ["add", "foobar +olasagasti @welaika"]
80
+ File.read(todo_path).should == read_fixture("add_results.txt")
81
+ out.strip.should == 'Issue created, see it at http://code.welaika.com/issues/3397'
97
82
  end
98
83
  end
99
84
  end
100
85
 
101
- pending "init"
86
+ after(:each) do
87
+ File.unlink(todo_path)
88
+ File.unlink(config_path)
89
+ end
102
90
 
103
91
  end
@@ -7,8 +7,8 @@ describe Redpomo::Tracker do
7
7
  Redpomo::Tracker.new(
8
8
  "welaika",
9
9
  url: "http://code.welaika.com",
10
- token: "WELAIKA_TOKEN",
11
- closed_status: "5"
10
+ token: "WELAIKA_TOKEN",#"WELAIKA_TOKEN",
11
+ closed_status_id: "5"
12
12
  )
13
13
  end
14
14
 
@@ -28,11 +28,45 @@ describe Redpomo::Tracker do
28
28
  issues = subject.issues
29
29
  issues.should have(7).issues
30
30
  issues.first.tracker.should == subject
31
- issues.first.project.should == 'dashboard-fiat'
31
+ issues.first.project_id.should == 'dashboard-fiat'
32
32
  issues.first.issue_id.should == 3316
33
33
  issues.first.due_date.should be_nil
34
34
  end
35
35
  end
36
36
  end
37
37
 
38
+ describe ".push_entry!" do
39
+ it "creates a TimeEntry" do
40
+ VCR.use_cassette('push_entry') do
41
+ task = stub(
42
+ issue: 3392,
43
+ text: "Foobar"
44
+ )
45
+ entry = stub(
46
+ to_task: task,
47
+ datetime: Date.new(2012, 1, 1),
48
+ duration: 5
49
+ )
50
+ result = subject.push_entry!(entry)
51
+ result["time_entry"]["issue"]["id"].should == 3392
52
+ end
53
+ end
54
+ end
55
+
56
+ describe ".create_issue!" do
57
+ it "creates an Issue" do
58
+ VCR.use_cassette('create_issue') do
59
+ issue = stub(
60
+ subject: "foo",
61
+ description: "bar",
62
+ due_date: Date.new(2012, 12, 1),
63
+ project_id: "olasagasti",
64
+ priority_id: 5
65
+ )
66
+ result = subject.create_issue!(issue)
67
+ result["issue"]["id"].should be_present
68
+ end
69
+ end
70
+ end
71
+
38
72
  end
data/spec/spec_helper.rb CHANGED
@@ -8,8 +8,14 @@ end
8
8
 
9
9
  Bundler.require(:default, :development)
10
10
 
11
+ require 'support/ruby_ext'
12
+ require 'support/cli_helpers'
13
+ require 'support/fixtures'
14
+
11
15
  RSpec.configure do |config|
12
16
  config.mock_framework = :mocha
17
+ config.include Spec::CLIHelpers
18
+ config.include Spec::Fixtures
13
19
  end
14
20
 
15
21
  VCR.configure do |c|
@@ -19,5 +25,3 @@ VCR.configure do |c|
19
25
  match_requests_on: [:method, :host, :path, :body]
20
26
  }
21
27
  end
22
-
23
- require 'support/capture'