taskrabbit 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.env.example +15 -0
- data/.gitignore +1 -0
- data/.rvmrc +1 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -0
- data/lib/taskrabbit.rb +1 -0
- data/lib/taskrabbit/api.rb +1 -0
- data/lib/taskrabbit/offer.rb +15 -0
- data/lib/taskrabbit/smash.rb +17 -2
- data/lib/taskrabbit/task.rb +11 -1
- data/lib/taskrabbit/version.rb +1 -1
- data/spec/spec_helper.rb +8 -4
- data/spec/support/cassettes/account/no_user.yml +2 -2
- data/spec/support/cassettes/account/properties.yml +46 -27
- data/spec/support/cassettes/account/tasks.yml +10 -10
- data/spec/support/cassettes/account/with_user.yml +5 -5
- data/spec/support/cassettes/cities/all.yml +2 -2
- data/spec/support/cassettes/cities/find.yml +2 -2
- data/spec/support/cassettes/cities/properties.yml +2 -2
- data/spec/support/cassettes/errors/404.yml +28 -356
- data/spec/support/cassettes/locations/properties.yml +8 -8
- data/spec/support/cassettes/tasks/all.yml +2 -2
- data/spec/support/cassettes/tasks/create/default.yml +3 -3
- data/spec/support/cassettes/tasks/create/using_account.yml +3 -3
- data/spec/support/cassettes/tasks/create/with_invalid_params.yml +3 -3
- data/spec/support/cassettes/tasks/create/with_location.yml +3 -3
- data/spec/support/cassettes/tasks/create/with_times.yml +45 -0
- data/spec/support/cassettes/tasks/create/without_credit_card.yml +2 -2
- data/spec/support/cassettes/tasks/create/without_user.yml +2 -2
- data/spec/support/cassettes/tasks/delete.yml +6 -6
- data/spec/support/cassettes/tasks/find.yml +41 -26
- data/spec/support/cassettes/tasks/properties.yml +41 -26
- data/spec/support/cassettes/tasks/save.yml +6 -6
- data/spec/support/cassettes/tasks/update.yml +6 -6
- data/spec/support/cassettes/tasks/with_offers_properties.yml +45 -0
- data/spec/support/cassettes/tasks/without_client.yml +27 -23
- data/spec/support/cassettes/users/find.yml +61 -23
- data/spec/support/cassettes/users/properties.yml +35 -27
- data/spec/support/cassettes/users/tasks/all.yml +42 -27
- data/spec/taskrabbit/account_spec.rb +10 -10
- data/spec/taskrabbit/api_spec.rb +1 -1
- data/spec/taskrabbit/city_spec.rb +3 -3
- data/spec/taskrabbit/location_spec.rb +1 -1
- data/spec/taskrabbit/offer_spec.rb +23 -0
- data/spec/taskrabbit/smash_spec.rb +19 -0
- data/spec/taskrabbit/task_spec.rb +36 -22
- data/spec/taskrabbit/user_spec.rb +10 -10
- metadata +11 -3
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :get
|
5
|
+
uri: https://taskrabbitdev.com:443/api/v1/tasks/52?include[task][]=errors&include[task][]=links&include[task][]=error&include[task][]=id&include[task][]=name&include[task][]=user&include[task][]=runner&include[task][]=runners&include[task][]=named_price&include[task][]=charge_price&include[task][]=cost_in_cents&include[task][]=number_runners_to_fill&include[task][]=state_label&include[task][]=city_id&include[task][]=city&include[task][]=description&include[task][]=private_description&include[task][]=private_runner&include[task][]=virtual&include[task][]=state&include[task][]=assignment_type&include[task][]=complete_by_time&include[task][]=state_changed_at&include[task][]=assign_by_time&include[task][]=location_visits&include[task][]=offers&include[task][]=other_locations_attributes&include[task][]=uploaded_photos_attributes&include[task][]=uploaded_sounds_attributes
|
6
|
+
body:
|
7
|
+
headers:
|
8
|
+
x-client-application:
|
9
|
+
- ''
|
10
|
+
authorization:
|
11
|
+
- OAuth <USER_WITH_CARD>
|
12
|
+
response: !ruby/struct:VCR::Response
|
13
|
+
status: !ruby/struct:VCR::ResponseStatus
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
server:
|
18
|
+
- nginx/1.0.11
|
19
|
+
date:
|
20
|
+
- Thu, 13 Sep 2012 00:52:45 GMT
|
21
|
+
content-type:
|
22
|
+
- application/json; charset=utf-8
|
23
|
+
status:
|
24
|
+
- 200 OK
|
25
|
+
set-cookie:
|
26
|
+
- current_geo=1053; path=/; expires=Tue, 13-Nov-2012 01:52:45 GMT
|
27
|
+
x-runtime:
|
28
|
+
- '0.186363'
|
29
|
+
content-length:
|
30
|
+
- '1245'
|
31
|
+
etag:
|
32
|
+
- ! '"1bb05d4c694e2dc4ee9b37e66b3175ba"'
|
33
|
+
x-ua-compatible:
|
34
|
+
- IE=Edge,chrome=1
|
35
|
+
cache-control:
|
36
|
+
- max-age=0, private, must-revalidate
|
37
|
+
body: ! '{"private_runner":false,"links":{"put":"/api/v1/tasks/52","html":"http://s-app1.taskrabbit.com/tasks/house-cleaning-7091","get":"/api/v1/tasks/52","offers":"/api/v1/tasks/52/offers","authenticated":"http://s-app1.taskrabbit.com/go/82d359e524666a2d8b96f6df1fbfcad4a720a0b4fed8c3f0985139a13a4d6433b65f7f05e80360af131d8f9638f8307e035b","delete":"/api/v1/tasks/52"},"charge_price":0,"runners":{"items":[]},"cost_in_cents":0,"id":52,"state_changed_at":1347490579,"assignment_type":"review","description":"I
|
38
|
+
need to clean my house","city":{"links":{"get":"/api/v1/cities/3"},"lat":37.77493,"id":1053,"lng":-122.419416,"name":"SF
|
39
|
+
Bay Area"},"assign_by_time":1347577200,"name":"House Cleaning","offers":{"items":[{"charge_price":26, "runner_id": 31, "id":7,"created_at":1347493865,"comments":"I
|
40
|
+
clean a lot!","state":"sent"}]},"location_visits":{"items":[{"lat":37.7867363,"zip":"94102","id":11,"complete":"213
|
41
|
+
Powell Street, San Francisco, CA, San Francisco, CA 94102","partial":"Powell
|
42
|
+
Street, San Francisco, CA, San Francisco, CA 94102","location_id":52,"lng":-122.4080542,"city":"San
|
43
|
+
Francisco","name":"Home","approximate_radius":0,"address":"213 Powell Street,
|
44
|
+
San Francisco, CA","state":"CA"}]},"state_label":"posted","complete_by_time":1347663600,"state":"opened"}'
|
45
|
+
http_version: '1.1'
|
@@ -1,30 +1,34 @@
|
|
1
|
-
---
|
2
|
-
- !ruby/struct:VCR::HTTPInteraction
|
3
|
-
request: !ruby/struct:VCR::Request
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
4
|
method: :get
|
5
|
-
uri:
|
5
|
+
uri: https://taskrabbitdev.com:443/api/v1/tasks?include[task][]=errors&include[task][]=links&include[task][]=error&include[task][]=id&include[task][]=name&include[task][]=user&include[task][]=runner&include[task][]=runners&include[task][]=named_price&include[task][]=charge_price&include[task][]=cost_in_cents&include[task][]=number_runners_to_fill&include[task][]=state_label&include[task][]=city_id&include[task][]=city&include[task][]=description&include[task][]=private_description&include[task][]=private_runner&include[task][]=virtual&include[task][]=state&include[task][]=assignment_type&include[task][]=complete_by_time&include[task][]=state_changed_at&include[task][]=assign_by_time&include[task][]=location_visits&include[task][]=offers&include[task][]=other_locations_attributes&include[task][]=uploaded_photos_attributes&include[task][]=uploaded_sounds_attributes
|
6
6
|
body:
|
7
|
-
headers:
|
8
|
-
x-client-application:
|
9
|
-
-
|
10
|
-
authorization:
|
7
|
+
headers:
|
8
|
+
x-client-application:
|
9
|
+
- ''
|
10
|
+
authorization:
|
11
11
|
- OAuth
|
12
|
-
response: !ruby/struct:VCR::Response
|
13
|
-
status: !ruby/struct:VCR::ResponseStatus
|
12
|
+
response: !ruby/struct:VCR::Response
|
13
|
+
status: !ruby/struct:VCR::ResponseStatus
|
14
14
|
code: 403
|
15
15
|
message: Forbidden
|
16
|
-
headers:
|
17
|
-
|
16
|
+
headers:
|
17
|
+
server:
|
18
|
+
- nginx/1.0.11
|
19
|
+
date:
|
20
|
+
- Thu, 13 Sep 2012 00:54:52 GMT
|
21
|
+
content-type:
|
18
22
|
- application/json; charset=utf-8
|
19
|
-
|
20
|
-
-
|
21
|
-
|
22
|
-
-
|
23
|
-
|
24
|
-
-
|
25
|
-
|
26
|
-
-
|
27
|
-
cache-control:
|
23
|
+
status:
|
24
|
+
- 403 Forbidden
|
25
|
+
x-runtime:
|
26
|
+
- '0.021289'
|
27
|
+
content-length:
|
28
|
+
- '44'
|
29
|
+
x-ua-compatible:
|
30
|
+
- IE=Edge,chrome=1
|
31
|
+
cache-control:
|
28
32
|
- no-cache
|
29
|
-
body:
|
30
|
-
http_version:
|
33
|
+
body: ! '{"error":"Missing valid client application"}'
|
34
|
+
http_version: '1.1'
|
@@ -1,32 +1,70 @@
|
|
1
|
-
---
|
2
|
-
- !ruby/struct:VCR::HTTPInteraction
|
3
|
-
request: !ruby/struct:VCR::Request
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
4
|
method: :get
|
5
|
-
uri:
|
5
|
+
uri: https://taskrabbitdev.com/api/v1/users/49719?
|
6
6
|
body:
|
7
|
-
headers:
|
8
|
-
x-client-application:
|
9
|
-
-
|
10
|
-
authorization:
|
7
|
+
headers:
|
8
|
+
x-client-application:
|
9
|
+
- <API_SECRET>
|
10
|
+
authorization:
|
11
11
|
- OAuth
|
12
|
-
response: !ruby/struct:VCR::Response
|
13
|
-
status: !ruby/struct:VCR::ResponseStatus
|
12
|
+
response: !ruby/struct:VCR::Response
|
13
|
+
status: !ruby/struct:VCR::ResponseStatus
|
14
14
|
code: 200
|
15
15
|
message: OK
|
16
|
-
headers:
|
17
|
-
etag:
|
18
|
-
- "
|
19
|
-
content-type:
|
16
|
+
headers:
|
17
|
+
etag:
|
18
|
+
- ! '"b17a2574110c83735c6cf13a269251f1"'
|
19
|
+
content-type:
|
20
20
|
- application/json; charset=utf-8
|
21
|
-
x-runtime:
|
22
|
-
-
|
23
|
-
server:
|
21
|
+
x-runtime:
|
22
|
+
- '198'
|
23
|
+
server:
|
24
24
|
- WEBrick/1.3.1 (Ruby/1.8.7/2011-02-18)
|
25
|
-
date:
|
25
|
+
date:
|
26
26
|
- Sat, 17 Mar 2012 23:13:19 GMT
|
27
|
-
content-length:
|
28
|
-
-
|
29
|
-
cache-control:
|
27
|
+
content-length:
|
28
|
+
- '200'
|
29
|
+
cache-control:
|
30
30
|
- private, max-age=0, must-revalidate
|
31
|
-
body:
|
32
|
-
|
31
|
+
body: ! '{"id":49719,"short_name":"John","full_name":"John D.","links":{"get":"/api/v1/users/49719","avatar_url":"http://local.taskrabbit.com/images/default_avatars/poster_thumb.png"},"display_name":"John
|
32
|
+
D."}'
|
33
|
+
http_version: '1.1'
|
34
|
+
- !ruby/struct:VCR::HTTPInteraction
|
35
|
+
request: !ruby/struct:VCR::Request
|
36
|
+
method: :get
|
37
|
+
uri: https://taskrabbitdev.com:443/api/v1/users/41?
|
38
|
+
body:
|
39
|
+
headers:
|
40
|
+
x-client-application:
|
41
|
+
- <API_SECRET>
|
42
|
+
authorization:
|
43
|
+
- OAuth
|
44
|
+
response: !ruby/struct:VCR::Response
|
45
|
+
status: !ruby/struct:VCR::ResponseStatus
|
46
|
+
code: 200
|
47
|
+
message: OK
|
48
|
+
headers:
|
49
|
+
server:
|
50
|
+
- nginx/1.0.11
|
51
|
+
date:
|
52
|
+
- Wed, 12 Sep 2012 23:03:43 GMT
|
53
|
+
content-type:
|
54
|
+
- application/json; charset=utf-8
|
55
|
+
status:
|
56
|
+
- 200 OK
|
57
|
+
x-runtime:
|
58
|
+
- '0.078733'
|
59
|
+
content-length:
|
60
|
+
- '376'
|
61
|
+
etag:
|
62
|
+
- ! '"c49fc243130e420dca38098f67caa19a"'
|
63
|
+
x-ua-compatible:
|
64
|
+
- IE=Edge,chrome=1
|
65
|
+
cache-control:
|
66
|
+
- max-age=0, private, must-revalidate
|
67
|
+
body: ! '{"links":{"get":"/api/v1/users/41","avatar_url":"http://s-app1.taskrabbit.com/images/default_avatars/poster_thumb.png"},"friend_code_url":"http://taskrabbit.com/PAL/41","id":41,"short_name":"User
|
68
|
+
with no","display_name":"User with no c.","city":{"links":{"get":"/api/v1/cities/3"},"lat":37.77493,"id":1053,"lng":-122.419416,"name":"SF
|
69
|
+
Bay Area"},"full_name":"User with no c."}'
|
70
|
+
http_version: '1.1'
|
@@ -1,32 +1,40 @@
|
|
1
|
-
---
|
2
|
-
- !ruby/struct:VCR::HTTPInteraction
|
3
|
-
request: !ruby/struct:VCR::Request
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
4
|
method: :get
|
5
|
-
uri:
|
5
|
+
uri: https://taskrabbitdev.com:443/api/v1/users/40?
|
6
6
|
body:
|
7
|
-
headers:
|
8
|
-
x-client-application:
|
9
|
-
-
|
10
|
-
authorization:
|
11
|
-
- OAuth
|
12
|
-
response: !ruby/struct:VCR::Response
|
13
|
-
status: !ruby/struct:VCR::ResponseStatus
|
7
|
+
headers:
|
8
|
+
x-client-application:
|
9
|
+
- <API_SECRET>
|
10
|
+
authorization:
|
11
|
+
- OAuth <USER_WITH_CARD>
|
12
|
+
response: !ruby/struct:VCR::Response
|
13
|
+
status: !ruby/struct:VCR::ResponseStatus
|
14
14
|
code: 200
|
15
15
|
message: OK
|
16
|
-
headers:
|
17
|
-
|
18
|
-
-
|
19
|
-
|
16
|
+
headers:
|
17
|
+
server:
|
18
|
+
- nginx/1.0.11
|
19
|
+
date:
|
20
|
+
- Wed, 12 Sep 2012 23:03:42 GMT
|
21
|
+
content-type:
|
20
22
|
- application/json; charset=utf-8
|
21
|
-
|
22
|
-
-
|
23
|
-
|
24
|
-
-
|
25
|
-
|
26
|
-
-
|
27
|
-
content-length:
|
28
|
-
-
|
29
|
-
|
30
|
-
-
|
31
|
-
|
32
|
-
|
23
|
+
status:
|
24
|
+
- 200 OK
|
25
|
+
set-cookie:
|
26
|
+
- current_geo=1053; path=/; expires=Tue, 13-Nov-2012 00:03:42 GMT
|
27
|
+
x-runtime:
|
28
|
+
- '0.087765'
|
29
|
+
content-length:
|
30
|
+
- '466'
|
31
|
+
etag:
|
32
|
+
- ! '"c9d1f78611ffb0dd20f73d8b07432075"'
|
33
|
+
x-ua-compatible:
|
34
|
+
- IE=Edge,chrome=1
|
35
|
+
cache-control:
|
36
|
+
- max-age=0, private, must-revalidate
|
37
|
+
body: ! '{"links":{"get":"/api/v1/users/40","avatar_url":"http://s-app1.taskrabbit.com/images/default_avatars/poster_thumb.png"},"first_name":"UserWith","friend_code_url":"http://taskrabbit.com/PAL/40","id":40,"short_name":"UserWith","display_name":"UserWith
|
38
|
+
c.","last_name":"card","city":{"links":{"get":"/api/v1/cities/3"},"lat":37.77493,"id":1053,"lng":-122.419416,"name":"SF
|
39
|
+
Bay Area"},"zip_code":"12345","full_name":"UserWith card","email":"userwithcard@taskrabbit.com"}'
|
40
|
+
http_version: '1.1'
|
@@ -1,32 +1,47 @@
|
|
1
|
-
---
|
2
|
-
- !ruby/struct:VCR::HTTPInteraction
|
3
|
-
request: !ruby/struct:VCR::Request
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
4
|
method: :get
|
5
|
-
uri:
|
5
|
+
uri: https://taskrabbitdev.com/api/v1/users/40/tasks?include[task][]=errors&include[task][]=links&include[task][]=error&include[task][]=id&include[task][]=name&include[task][]=user&include[task][]=runner&include[task][]=runners&include[task][]=named_price&include[task][]=charge_price&include[task][]=cost_in_cents&include[task][]=number_runners_to_fill&include[task][]=state_label&include[task][]=city_id&include[task][]=city&include[task][]=description&include[task][]=private_description&include[task][]=private_runner&include[task][]=virtual&include[task][]=state&include[task][]=assignment_type&include[task][]=complete_by_time&include[task][]=state_changed_at&include[task][]=assign_by_time&include[task][]=location_visits&include[task][]=offers&include[task][]=other_locations_attributes&include[task][]=uploaded_photos_attributes&include[task][]=uploaded_sounds_attributes
|
6
6
|
body:
|
7
|
-
headers:
|
8
|
-
x-client-application:
|
9
|
-
-
|
10
|
-
authorization:
|
11
|
-
- OAuth
|
12
|
-
response: !ruby/struct:VCR::Response
|
13
|
-
status: !ruby/struct:VCR::ResponseStatus
|
7
|
+
headers:
|
8
|
+
x-client-application:
|
9
|
+
- <API_SECRET>
|
10
|
+
authorization:
|
11
|
+
- OAuth <USER_WITH_CARD>
|
12
|
+
response: !ruby/struct:VCR::Response
|
13
|
+
status: !ruby/struct:VCR::ResponseStatus
|
14
14
|
code: 200
|
15
15
|
message: OK
|
16
|
-
headers:
|
17
|
-
|
18
|
-
-
|
19
|
-
|
16
|
+
headers:
|
17
|
+
server:
|
18
|
+
- nginx/1.0.11
|
19
|
+
date:
|
20
|
+
- Wed, 12 Sep 2012 23:03:44 GMT
|
21
|
+
content-type:
|
20
22
|
- application/json; charset=utf-8
|
21
|
-
|
22
|
-
-
|
23
|
-
|
24
|
-
-
|
25
|
-
|
26
|
-
-
|
27
|
-
content-length:
|
28
|
-
-
|
29
|
-
|
30
|
-
-
|
31
|
-
|
32
|
-
|
23
|
+
status:
|
24
|
+
- 200 OK
|
25
|
+
set-cookie:
|
26
|
+
- current_geo=1053; path=/; expires=Tue, 13-Nov-2012 00:03:44 GMT
|
27
|
+
x-runtime:
|
28
|
+
- '0.242963'
|
29
|
+
content-length:
|
30
|
+
- '1552'
|
31
|
+
etag:
|
32
|
+
- ! '"bb6fe1c81c51df832fa9f184dc72c50a"'
|
33
|
+
x-ua-compatible:
|
34
|
+
- IE=Edge,chrome=1
|
35
|
+
cache-control:
|
36
|
+
- max-age=0, private, must-revalidate
|
37
|
+
body: ! '{"links":{"first":"/api/v1/users/40/tasks?page=1","last":"/api/v1/users/40/tasks?page=1","get":"/api/v1/users/40/tasks"},"items":[{"links":{"put":"/api/v1/tasks/52","html":"http://s-app1.taskrabbit.com/tasks/house-cleaning-7091","get":"/api/v1/tasks/52","authenticated":"http://s-app1.taskrabbit.com/go/82d359e524666a2d8b96f6df1fbfcad4a720a0b4fed8c3f0985139a13a4d6433b65f7f05e80360af131d8f9638f8307e035b","delete":"/api/v1/tasks/52"},"private_runner":false,"charge_price":23,"runners":{"items":[]},"id":52,"cost_in_cents":0,"state_changed_at":1347490579,"named_price":23,"description":"I
|
38
|
+
need to clean my house","assignment_type":"auto","name":"House Cleaning","assign_by_time":1347577200,"city":{"links":{"get":"/api/v1/cities/3"},"lat":37.77493,"id":1053,"lng":-122.419416,"name":"SF
|
39
|
+
Bay Area"},"runner_fee":0,"complete_by_time":1347663600,"state_label":"posted","description_properties":[{"value":"I
|
40
|
+
need to clean my house","key":"description","title":"Description"},{"value":null,"key":"private_description","title":"Private
|
41
|
+
description"},{"value":"Regular Maintenance","key":"task_field_16","title":"Level
|
42
|
+
of cleaning"},{"value":"Multiple Rooms, 1 Bathroom","key":"task_field_17","title":"Size
|
43
|
+
of house"},{"value":"Cleaning supplies are already in the house","key":"task_field_18","title":"Do
|
44
|
+
you have all the necessary cleaning supplies at your house"},{"value":1347577200,"key":"assign_by_time","title":"If
|
45
|
+
unassigned, Task will expire on"},{"value":1347663600,"key":"complete_by_time","title":"Task
|
46
|
+
should be completed by"}],"state":"opened"}]}'
|
47
|
+
http_version: '1.1'
|
@@ -4,7 +4,7 @@ describe Taskrabbit::Account do
|
|
4
4
|
describe "account properties" do
|
5
5
|
before :all do
|
6
6
|
tr = Taskrabbit::Api.new(TR_USERS[:with_card][:secret])
|
7
|
-
VCR.use_cassette('account/properties', :record => :
|
7
|
+
VCR.use_cassette('account/properties', :record => :none) do
|
8
8
|
@user = tr.account
|
9
9
|
@user.fetch
|
10
10
|
end
|
@@ -13,17 +13,17 @@ describe Taskrabbit::Account do
|
|
13
13
|
subject { @user }
|
14
14
|
|
15
15
|
its(:id) { should == TR_USERS[:with_card][:id] }
|
16
|
-
its(:short_name) { should == "
|
17
|
-
its(:first_name) { should == "
|
18
|
-
its(:full_name) { should == "
|
19
|
-
its(:display_name) { should == "
|
16
|
+
its(:short_name) { should == "UserWith" }
|
17
|
+
its(:first_name) { should == "UserWith" }
|
18
|
+
its(:full_name) { should == "UserWith card" }
|
19
|
+
its(:display_name) { should == "UserWith c." }
|
20
20
|
its(:runner) { should == false }
|
21
|
-
its(:email) { should == '
|
21
|
+
its(:email) { should == 'userwithcard@taskrabbit.com' }
|
22
22
|
its(:mobile_phone) { should == nil }
|
23
23
|
its(:home_phone) { should == nil }
|
24
24
|
its(:tasks) { should be_a(Taskrabbit::Collection) } # TaskRabbit returns tasks in the json
|
25
25
|
its(:city) { should be_instance_of(Taskrabbit::City) }
|
26
|
-
its(:zip_code) { should == "
|
26
|
+
its(:zip_code) { should == "12345" }
|
27
27
|
its(:locations) { should be_a(Taskrabbit::Collection) } # TaskRabbit returns locations in the json
|
28
28
|
its(:links) { should be_instance_of(Hash) }
|
29
29
|
end
|
@@ -32,7 +32,7 @@ describe Taskrabbit::Account do
|
|
32
32
|
describe ".account" do
|
33
33
|
it "should return an error if the user is not passed" do
|
34
34
|
tr = Taskrabbit::Api.new
|
35
|
-
VCR.use_cassette('account/no_user', :record => :
|
35
|
+
VCR.use_cassette('account/no_user', :record => :none) do
|
36
36
|
tr_account = nil
|
37
37
|
expect { tr_account = tr.account }.to_not raise_error
|
38
38
|
expect { tr_account = tr_account.short_name }.to raise_error(Taskrabbit::Error, 'There must be an authenticated user for this action')
|
@@ -41,7 +41,7 @@ describe Taskrabbit::Account do
|
|
41
41
|
|
42
42
|
it "should return the account of the user" do
|
43
43
|
tr = Taskrabbit::Api.new(TR_USERS[:with_card][:secret])
|
44
|
-
VCR.use_cassette('account/with_user', :record => :
|
44
|
+
VCR.use_cassette('account/with_user', :record => :none) do
|
45
45
|
tr_account = nil
|
46
46
|
expect { tr_account = tr.account }.to_not raise_error
|
47
47
|
tr_account.short_name.should == 'Bob'
|
@@ -52,7 +52,7 @@ describe Taskrabbit::Account do
|
|
52
52
|
describe ".tasks" do
|
53
53
|
it "should fetch the tasks of the user" do
|
54
54
|
tr = Taskrabbit::Api.new(TR_USERS[:with_card][:secret])
|
55
|
-
VCR.use_cassette('account/tasks', :record => :
|
55
|
+
VCR.use_cassette('account/tasks', :record => :none) do
|
56
56
|
tr_account = nil
|
57
57
|
expect { tr_account = tr.account }.to_not raise_error
|
58
58
|
account_tasks = tr_account.tasks.all
|
data/spec/taskrabbit/api_spec.rb
CHANGED
@@ -28,7 +28,7 @@ describe Taskrabbit::Api do
|
|
28
28
|
it "should return an error if the client is not set" do
|
29
29
|
tr = Taskrabbit::Api.new
|
30
30
|
VCR.use_cassette('errors/404', :record => :new_episodes) do
|
31
|
-
expect { tr.tasks.find('something-that-doesnot-exists').name }.to raise_error(Taskrabbit::Error, '
|
31
|
+
expect { tr.tasks.find('something-that-doesnot-exists').name }.to raise_error(Taskrabbit::Error, 'The requested resource could not be found')
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -6,7 +6,7 @@ describe Taskrabbit::City do
|
|
6
6
|
|
7
7
|
before :all do
|
8
8
|
tr = Taskrabbit::Api.new
|
9
|
-
VCR.use_cassette('cities/properties', :record => :
|
9
|
+
VCR.use_cassette('cities/properties', :record => :none) do
|
10
10
|
@city = tr.cities.find(3)
|
11
11
|
@city.fetch
|
12
12
|
end
|
@@ -25,7 +25,7 @@ describe Taskrabbit::City do
|
|
25
25
|
describe "#all" do
|
26
26
|
it "should fetch all cities" do
|
27
27
|
tr = Taskrabbit::Api.new
|
28
|
-
VCR.use_cassette('cities/all', :record => :
|
28
|
+
VCR.use_cassette('cities/all', :record => :none) do
|
29
29
|
cities = nil
|
30
30
|
expect { cities = tr.cities }.to_not raise_error
|
31
31
|
cities.should == Taskrabbit::City
|
@@ -49,7 +49,7 @@ describe Taskrabbit::City do
|
|
49
49
|
|
50
50
|
it "should should fetch the city" do
|
51
51
|
tr = Taskrabbit::Api.new
|
52
|
-
VCR.use_cassette('cities/find', :record => :
|
52
|
+
VCR.use_cassette('cities/find', :record => :none) do
|
53
53
|
city = nil
|
54
54
|
expect { city = tr.cities.find(3) }.to_not raise_error
|
55
55
|
city.id.should == 3
|
@@ -6,7 +6,7 @@ describe Taskrabbit::Location do
|
|
6
6
|
|
7
7
|
before :all do
|
8
8
|
tr = Taskrabbit::Api.new(TR_USERS[:with_card][:secret])
|
9
|
-
VCR.use_cassette('locations/properties', :record => :
|
9
|
+
VCR.use_cassette('locations/properties', :record => :none) do
|
10
10
|
@location = tr.account.locations.first
|
11
11
|
end
|
12
12
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Taskrabbit::Location do
|
4
|
+
|
5
|
+
describe "offers properties" do
|
6
|
+
|
7
|
+
before :all do
|
8
|
+
tr = Taskrabbit::Api.new(TR_USERS[:with_card][:secret])
|
9
|
+
VCR.use_cassette('tasks/with_offers_properties', :record => :none) do
|
10
|
+
@tr_task = tr.tasks.find(ENV["TASK_ID"])
|
11
|
+
@tr_task.fetch
|
12
|
+
end
|
13
|
+
@offer = @tr_task.offers.first
|
14
|
+
end
|
15
|
+
|
16
|
+
subject { @offer }
|
17
|
+
|
18
|
+
its(:id ) { should == 7 }
|
19
|
+
its(:charge_price ) { should == 26 }
|
20
|
+
its(:state ) { should == "sent" }
|
21
|
+
its(:runner_id ) { should == 31 }
|
22
|
+
end
|
23
|
+
end
|