Browse files

Properly handle parsed responses from sauce's API

  • Loading branch information...
1 parent ed2e1e7 commit b763f86b9db2edf4b0302bc42687eae86f76cbbe @rtyler committed Aug 5, 2012
Showing with 5 additions and 5 deletions.
  1. +1 −1 features/step_definitions/watch_steps.rb
  2. +2 −2 lib/saucetv/api.rb
  3. +1 −1 lib/saucetv/views/watch.haml
  4. +1 −1 spec/api_spec.rb
View
2 features/step_definitions/watch_steps.rb
@@ -13,7 +13,7 @@
end
Given /^I have recent jobs$/ do
- SauceTV::API.any_instance.stub(:recent_jobs).and_return([{:id => 'test'}])
+ SauceTV::API.any_instance.stub(:recent_jobs).and_return([{'id' => 'test'}])
end
When /^I try to watch videos$/ do
View
4 lib/saucetv/api.rb
@@ -43,10 +43,10 @@ def recent_jobs
# I believe that this should only be true if we receive non-JSON back
# from the API. Otherwise, I *think* HTTParty will return parsed JSON
# (Array)
- if response.body.instance_of? String
+ if response.parsed_response.instance_of? String
[]
else
- response.body
+ response.parsed_response
end
end
end
View
2 lib/saucetv/views/watch.haml
@@ -8,5 +8,5 @@
%ul#jobs
- jobs.each do |job|
%li.job
- #{job[:id]}
+ #{job['id']}
View
2 spec/api_spec.rb
@@ -30,7 +30,7 @@
response = mock('HTTParty::Response')
response.stub(:code).and_return(200)
markup = "<html><body>Failboat</body></html>"
- response.stub(:body).and_return(markup)
+ response.stub(:parsed_response).and_return(markup)
response
end

0 comments on commit b763f86

Please sign in to comment.