Permalink
Browse files

Rerecord cassettes using vcr filtering.

  • Loading branch information...
Brian Leonard & Steve Hull authored and nolastan committed Sep 12, 2012
1 parent e196781 commit eebfbc3f7de5afbddc92f4a262a16a509b00fa08
Showing with 423 additions and 196 deletions.
  1. +8 −4 spec/spec_helper.rb
  2. +2 −2 spec/support/cassettes/account/no_user.yml
  3. +46 −27 spec/support/cassettes/account/properties.yml
  4. +2 −2 spec/support/cassettes/account/tasks.yml
  5. +5 −5 spec/support/cassettes/account/with_user.yml
  6. +1 −1 spec/support/cassettes/cities/all.yml
  7. +1 −1 spec/support/cassettes/cities/find.yml
  8. +1 −1 spec/support/cassettes/cities/properties.yml
  9. +1 −1 spec/support/cassettes/errors/404.yml
  10. +2 −2 spec/support/cassettes/locations/properties.yml
  11. +1 −1 spec/support/cassettes/tasks/all.yml
  12. +1 −1 spec/support/cassettes/tasks/create/default.yml
  13. +1 −1 spec/support/cassettes/tasks/create/using_account.yml
  14. +1 −1 spec/support/cassettes/tasks/create/with_invalid_params.yml
  15. +1 −1 spec/support/cassettes/tasks/create/with_location.yml
  16. +1 −1 spec/support/cassettes/tasks/create/without_credit_card.yml
  17. +1 −1 spec/support/cassettes/tasks/create/without_user.yml
  18. +2 −2 spec/support/cassettes/tasks/delete.yml
  19. +71 −22 spec/support/cassettes/tasks/find.yml
  20. +74 −22 spec/support/cassettes/tasks/properties.yml
  21. +2 −2 spec/support/cassettes/tasks/save.yml
  22. +2 −2 spec/support/cassettes/tasks/update.yml
  23. +1 −1 spec/support/cassettes/tasks/without_client.yml
  24. +60 −22 spec/support/cassettes/users/find.yml
  25. +35 −27 spec/support/cassettes/users/properties.yml
  26. +79 −22 spec/support/cassettes/users/tasks/all.yml
  27. +6 −6 spec/taskrabbit/account_spec.rb
  28. +8 −8 spec/taskrabbit/task_spec.rb
  29. +7 −7 spec/taskrabbit/user_spec.rb
View
@@ -10,16 +10,16 @@
CASSETTES_PATH = File.join(File.dirname(__FILE__), "support", "cassettes")
TR_USERS = {
- :with_card => {:secret => 'RhyRtRg1bRNyqmdozkY6JJJ3eGDpoRGTm9AXUudp', :id => 49720},
- :without_card => {:secret => 'sjCuNHsxMRkFiJGpLWZzYJksDjfnXtDvDcPuuDkn', :id => 49719},
+ :with_card => {:secret => ENV['USER_WITH_CARD'], :id => ENV['USER_WITH_CARD_ID'].to_i },
+ :without_card => {:secret => ENV['USER_WITHOUT_CARD'], :id => ENV['USER_WITHOUT_CARD_ID'].to_i },
}
module Taskrabbit
module Config
remove_const(:DEFAULT_BASE_URI)
remove_const(:DEFAULT_API_SECRET)
- DEFAULT_BASE_URI = 'http://localhost:3000'
- DEFAULT_API_SECRET = 'euqmQpzV04GmN1dJTY639PdI7eiSjCjI3lKTkPWn'
+ DEFAULT_BASE_URI = 'https://taskrabbitdev.com'
+ DEFAULT_API_SECRET = ENV['API_SECRET']
end
end
Taskrabbit.reset
@@ -29,5 +29,9 @@ module Config
VCR.config do |c|
c.cassette_library_dir = CASSETTES_PATH
+ c.filter_sensitive_data('<API_SECRET>') { ENV['API_SECRET'] }
+ c.filter_sensitive_data('<API_KEY>') { ENV['API_KEY'] }
+ c.filter_sensitive_data('<USER_WITH_CARD>') { ENV['USER_WITH_CARD'] }
+ c.filter_sensitive_data('<USER_WITHOUT_CARD>') { ENV['USER_WITHOUT_CARD'] }
c.stub_with :fakeweb
end
@@ -2,11 +2,11 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :get
- uri: http://localhost:3000/api/v1/account?
+ uri: https://taskrabbitdev.com/api/v1/account?
body:
headers:
x-client-application:
- - euqmQpzV04GmN1dJTY639PdI7eiSjCjI3lKTkPWn
+ - <API_SECRET>
authorization:
- OAuth
response: !ruby/struct:VCR::Response
@@ -1,32 +1,51 @@
----
-- !ruby/struct:VCR::HTTPInteraction
- request: !ruby/struct:VCR::Request
+---
+- !ruby/struct:VCR::HTTPInteraction
+ request: !ruby/struct:VCR::Request
method: :get
- uri: http://localhost:3000/api/v1/account?
+ uri: https://taskrabbitdev.com:443/api/v1/account?
body:
- headers:
- x-client-application:
- - euqmQpzV04GmN1dJTY639PdI7eiSjCjI3lKTkPWn
- authorization:
- - OAuth RhyRtRg1bRNyqmdozkY6JJJ3eGDpoRGTm9AXUudp
- response: !ruby/struct:VCR::Response
- status: !ruby/struct:VCR::ResponseStatus
+ headers:
+ x-client-application:
+ - <API_SECRET>
+ authorization:
+ - OAuth <USER_WITH_CARD>
+ response: !ruby/struct:VCR::Response
+ status: !ruby/struct:VCR::ResponseStatus
code: 200
message: OK
- headers:
- etag:
- - "\"1e7456943686e7860596b08fd8493a2b\""
- content-type:
+ headers:
+ server:
+ - nginx/1.0.11
+ date:
+ - Wed, 12 Sep 2012 23:05:11 GMT
+ content-type:
- application/json; charset=utf-8
- x-runtime:
- - "3518"
- server:
- - WEBrick/1.3.1 (Ruby/1.8.7/2011-02-18)
- date:
- - Sat, 17 Mar 2012 23:12:06 GMT
- content-length:
- - "2956"
- cache-control:
- - private, max-age=0, must-revalidate
- body: "{\"city\":{\"name\":\"SF Bay Area\",\"lng\":-122.419416,\"id\":3,\"links\":{\"get\":\"/api/v1/cities/3\"},\"lat\":37.77493},\"zip_code\":\"64321\",\"id\":49720,\"tasks\":{\"items\":[{\"name\":\"My First Task\",\"city\":{\"name\":\"New York City\",\"lng\":-74.005973,\"id\":4,\"links\":{\"get\":\"/api/v1/cities/4\"},\"lat\":40.714353},\"charge_price\":20,\"private_runner\":false,\"named_price\":20,\"complete_by_time\":1332093600,\"id\":22673,\"state_changed_at\":1332025380,\"cost_in_cents\":0,\"links\":{\"html\":\"http://local.taskrabbit.com/tasks/my-first-task--47\",\"get\":\"/api/v1/tasks/22673\",\"delete\":\"/api/v1/tasks/22673\",\"put\":\"/api/v1/tasks/22673\",\"authenticated\":\"http://local.taskrabbit.com/go/2f249e87a04016d741f163fe991468737e367c8e334eb5d5a53a63d741ce0019ba1a9c33366a76cadc06bdcb9259c5549a44\"},\"runners\":{\"items\":[]},\"state_label\":\"posted\",\"assign_by_time\":1332082800,\"state\":\"opened\"},{\"name\":\"New Name\",\"city\":{\"name\":\"New York City\",\"lng\":-74.005973,\"id\":4,\"links\":{\"get\":\"/api/v1/cities/4\"},\"lat\":40.714353},\"charge_price\":20,\"private_runner\":false,\"named_price\":20,\"complete_by_time\":1332093600,\"id\":22674,\"state_changed_at\":1332025387,\"cost_in_cents\":0,\"links\":{\"html\":\"http://local.taskrabbit.com/tasks/new-name--3\",\"get\":\"/api/v1/tasks/22674\",\"delete\":\"/api/v1/tasks/22674\",\"put\":\"/api/v1/tasks/22674\",\"authenticated\":\"http://local.taskrabbit.com/go/459b5e05e7a6542891148717ed9cdd4a25fb5d5f71f094c098a93beb25ba26303c4ea5e2c8e01da3743703abbe1da5b46980\"},\"runners\":{\"items\":[]},\"state_label\":\"posted\",\"assign_by_time\":1332082800,\"state\":\"opened\"},{\"name\":\"My First Task\",\"city\":{\"name\":\"New York City\",\"lng\":-74.005973,\"id\":4,\"links\":{\"get\":\"/api/v1/cities/4\"},\"lat\":40.714353},\"charge_price\":20,\"private_runner\":false,\"named_price\":20,\"complete_by_time\":1332093600,\"id\":22675,\"state_changed_at\":1332025394,\"cost_in_cents\":0,\"links\":{\"html\":\"http://local.taskrabbit.com/tasks/my-first-task--49\",\"get\":\"/api/v1/tasks/22675\",\"delete\":\"/api/v1/tasks/22675\",\"put\":\"/api/v1/tasks/22675\",\"authenticated\":\"http://local.taskrabbit.com/go/a89862d84f6a3b8b3175c46bc824ba3c4086519395730898237d56ef90ad672e540e62370c6a87b6c6ec2f601c10e2486ba7\"},\"runners\":{\"items\":[]},\"state_label\":\"posted\",\"assign_by_time\":1332082800,\"state\":\"opened\"}],\"links\":{\"get\":\"/api/v1/users/49720/tasks\",\"last\":\"/api/v1/users/49720/tasks?page=1\",\"first\":\"/api/v1/users/49720/tasks?page=1\"}},\"short_name\":\"Bob\",\"full_name\":\"Bob Sponge\",\"last_name\":\"Sponge\",\"links\":{\"get\":\"/api/v1/users/49720\",\"avatar_url\":\"http://local.taskrabbit.com/images/default_avatars/poster_thumb.png\"},\"display_name\":\"Bob S.\",\"locations\":{\"items\":[{\"name\":\"Home\",\"city\":\"San Francisco\",\"approximate_radius\":0,\"address\":\"432 example\",\"zip\":\"94123\",\"partial\":\"example, San Francisco, Ca 94123\",\"id\":37439,\"lng\":2.108266,\"complete\":\"432 example, San Francisco, Ca 94123\",\"lat\":41.5512199,\"state\":\"Ca\"}],\"links\":{\"get\":\"/api/v1/users/49720/locations\"}},\"email\":\"bobsponge@example.com\",\"first_name\":\"Bob\",\"counts\":{\"posted_tasks\":30,\"active_tasks\":3,\"ongoing_tasks\":3}}"
- http_version: "1.1"
+ status:
+ - 200 OK
+ set-cookie:
+ - current_geo=1053; path=/; expires=Tue, 13-Nov-2012 00:05:11 GMT
+ x-runtime:
+ - '0.276146'
+ content-length:
+ - '2486'
+ etag:
+ - ! '"a161b4e56960d3355460e1e8621d6892"'
+ x-ua-compatible:
+ - IE=Edge,chrome=1
+ cache-control:
+ - max-age=0, private, must-revalidate
+ body: ! '{"links":{"get":"/api/v1/users/40","avatar_url":"http://s-app1.taskrabbit.com/images/default_avatars/poster_thumb.png"},"tasks":{"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","get":"/api/v1/tasks/52","html":"http://s-app1.taskrabbit.com/tasks/house-cleaning-7091","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
+ need to clean my house","assignment_type":"auto","name":"House Cleaning","assign_by_time":1347577200,"city":{"lat":37.77493,"links":{"get":"/api/v1/cities/3"},"id":1053,"name":"SF
+ Bay Area","lng":-122.419416},"runner_fee":0,"complete_by_time":1347663600,"state_label":"posted","description_properties":[{"value":"I
+ need to clean my house","key":"description","title":"Description"},{"value":null,"key":"private_description","title":"Private
+ description"},{"value":"Regular Maintenance","key":"task_field_16","title":"Level
+ of cleaning"},{"value":"Multiple Rooms, 1 Bathroom","key":"task_field_17","title":"Size
+ of house"},{"value":"Cleaning supplies are already in the house","key":"task_field_18","title":"Do
+ you have all the necessary cleaning supplies at your house"},{"value":1347577200,"key":"assign_by_time","title":"If
+ unassigned, Task will expire on"},{"value":1347663600,"key":"complete_by_time","title":"Task
+ should be completed by"}],"state":"opened"}]},"first_name":"UserWith","friend_code_url":"http://taskrabbit.com/PAL/40","counts":{"posted_tasks":1,"active_tasks":1,"ongoing_tasks":1},"id":40,"short_name":"UserWith","locations":{"links":{"get":"/api/v1/users/40/locations"},"items":[{"lat":37.7867363,"zip":"94102","id":52,"partial":"Powell
+ Street, San Francisco, CA, San Francisco, CA 94102","complete":"213 Powell Street,
+ San Francisco, CA, San Francisco, CA 94102","name":"Home","city":"San Francisco","lng":-122.4080542,"approximate_radius":0,"address":"213
+ Powell Street, San Francisco, CA","state":"CA"}]},"display_name":"UserWith c.","last_name":"card","city":{"links":{"get":"/api/v1/cities/3"},"lat":37.77493,"id":1053,"lng":-122.419416,"name":"SF
+ Bay Area"},"zip_code":"12345","full_name":"UserWith card","email":"userwithcard@taskrabbit.com"}'
+ http_version: '1.1'
@@ -2,7 +2,7 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :get
- uri: http://localhost:3000/api/v1/account?
+ uri: https://taskrabbitdev.com/api/v1/account?
body:
headers:
x-client-application:
@@ -33,7 +33,7 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :get
- uri: http://localhost:3000/api/v1/users/49720/tasks?
+ uri: https://taskrabbitdev.com/api/v1/users/49720/tasks?
body:
headers:
x-client-application:
@@ -2,13 +2,13 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :get
- uri: http://localhost:3000/api/v1/account?
+ uri: https://taskrabbitdev.com/api/v1/account?
body:
headers:
- x-client-application:
- - euqmQpzV04GmN1dJTY639PdI7eiSjCjI3lKTkPWn
- authorization:
- - OAuth RhyRtRg1bRNyqmdozkY6JJJ3eGDpoRGTm9AXUudp
+ x-client-application:
+ - <API_SECRET>
+ authorization:
+ - OAuth <USER_WITH_CARD>
response: !ruby/struct:VCR::Response
status: !ruby/struct:VCR::ResponseStatus
code: 200
@@ -2,7 +2,7 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :get
- uri: http://localhost:3000/api/v1/cities?
+ uri: https://taskrabbitdev.com/api/v1/cities?
body:
headers:
x-client-application:
@@ -2,7 +2,7 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :get
- uri: http://localhost:3000/api/v1/cities/3?
+ uri: https://taskrabbitdev.com/api/v1/cities/3?
body:
headers:
x-client-application:
@@ -2,7 +2,7 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :get
- uri: http://localhost:3000/api/v1/cities/3?
+ uri: https://taskrabbitdev.com/api/v1/cities/3?
body:
headers:
x-client-application:
@@ -2,7 +2,7 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :get
- uri: http://localhost:3000/api/v1/tasks/something-that-doesnot-exists?
+ uri: https://taskrabbitdev.com/api/v1/tasks/something-that-doesnot-exists?
body:
headers:
x-client-application:
@@ -2,7 +2,7 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :get
- uri: http://localhost:3000/api/v1/account?
+ uri: https://taskrabbitdev.com/api/v1/account?
body:
headers:
x-client-application:
@@ -33,7 +33,7 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :get
- uri: http://localhost:3000/api/v1/users/49720/locations?
+ uri: https://taskrabbitdev.com/api/v1/users/49720/locations?
body:
headers:
x-client-application:
@@ -2,7 +2,7 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :get
- uri: http://localhost:3000/api/v1/tasks?
+ uri: https://taskrabbitdev.com/api/v1/tasks?
body:
headers:
x-client-application:
@@ -2,7 +2,7 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :post
- uri: http://localhost:3000/api/v1/tasks?
+ uri: https://taskrabbitdev.com/api/v1/tasks?
body: task[name]=My%20First%20Task&task[named_price]=20&task[city_id]=4
headers:
x-client-application:
@@ -2,7 +2,7 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :post
- uri: http://localhost:3000/api/v1/tasks?
+ uri: https://taskrabbitdev.com/api/v1/tasks?
body: task[name]=My%20First%20Task&task[named_price]=20&task[city_id]=4
headers:
x-client-application:
@@ -2,7 +2,7 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :post
- uri: http://localhost:3000/api/v1/tasks?
+ uri: https://taskrabbitdev.com/api/v1/tasks?
body:
headers:
x-client-application:
@@ -2,7 +2,7 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :post
- uri: http://localhost:3000/api/v1/tasks?
+ uri: https://taskrabbitdev.com/api/v1/tasks?
body: task[name]=My%20First%20Task&task[named_price]=20&task[city_id]=4&task[other_locations_attributes][][city]=Boston&task[other_locations_attributes][][address]=123%20Main%20St&task[other_locations_attributes][][name]=Home&task[other_locations_attributes][][zip]=02154&task[other_locations_attributes][][lng]=-71.059774&task[other_locations_attributes][][lat]=42.358432&task[other_locations_attributes][][state]=MA&task[other_locations_attributes][][name]=Middle%20of%20the%20park&task[other_locations_attributes][][lng]=-71.059772&task[other_locations_attributes][][lat]=42.358430
headers:
x-client-application:
@@ -2,7 +2,7 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :post
- uri: http://localhost:3000/api/v1/tasks?
+ uri: https://taskrabbitdev.com/api/v1/tasks?
body: task[name]=My%20First%20Task&task[named_price]=20&task[city_id]=4
headers:
x-client-application:
@@ -2,7 +2,7 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :post
- uri: http://localhost:3000/api/v1/tasks?
+ uri: https://taskrabbitdev.com/api/v1/tasks?
body: task[name]=My%20First%20Task&task[named_price]=20&task[city_id]=4
headers:
x-client-application:
@@ -2,7 +2,7 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :post
- uri: http://localhost:3000/api/v1/tasks?
+ uri: https://taskrabbitdev.com/api/v1/tasks?
body: task[name]=My%20First%20Task&task[named_price]=20&task[city_id]=4
headers:
x-client-application:
@@ -33,7 +33,7 @@
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :delete
- uri: http://localhost:3000/api/v1/tasks/22678?
+ uri: https://taskrabbitdev.com/api/v1/tasks/22678?
body:
headers:
x-client-application:
Oops, something went wrong.

0 comments on commit eebfbc3

Please sign in to comment.