Skip to content
Browse files

Corrected the specs to check for the right results and updated the co…

…rresponding json fixtures to the accurate ones
  • Loading branch information...
1 parent b180c7d commit 1973e852c50ed1e812a45a5657b1c90c9d7a824b Anil V committed Aug 3, 2011
View
4 lib/rdio_api/api.rb
@@ -13,8 +13,8 @@ def method_missing(method_sym, *arguments)
response.body.result
elsif AUTHENTICATED.include?(method_sym)
if authenticated_connection
- Hashie::Mash.new(MultiJson.decode(authenticated_connection.post(api_url,
- {:method => method_sym.to_s}.merge!(Hash[*arguments.flatten])).body)['result'])
+ response = MultiJson.decode(authenticated_connection.post(api_url, {:method => method_sym.to_s}.merge!(Hash[*arguments.flatten])).body)['result']
+ response.is_a?(Hash) ? Hashie::Mash.new(response) : response
else
"Set access token at initialization or the client's access_token instance variable"
end
View
5 spec/fixtures/addFriend.json
@@ -1,7 +1,4 @@
{
"status" :"ok",
- "result" :
- {
- "result": "true"
- }
+ "result" : "true"
}
View
5 spec/fixtures/addToCollection.json
@@ -1,7 +1,4 @@
{
"status" :"ok",
- "result" :
- {
- "result": "true"
- }
+ "result" : "true"
}
View
5 spec/fixtures/addToPlaylist.json
@@ -1,7 +1,4 @@
{
"status" :"ok",
- "result" :
- {
- "result": "true"
- }
+ "result" : "true"
}
View
5 spec/fixtures/deletePlaylist.json
@@ -1,7 +1,4 @@
{
"status" :"ok",
- "result" :
- {
- "result": "true"
- }
+ "result" : "true"
}
View
5 spec/fixtures/getPlaybackToken.json
@@ -1,7 +1,4 @@
{
"status" :"ok",
- "result" :
- {
- "result": "flkasdjFA5lkdjf90asdfli2l9cnlkasdj9"
- }
+ "result" : "flkasdjFA5lkdjf90asdfli2l9cnlkasdj9"
}
View
5 spec/fixtures/removeFriend.json
@@ -1,7 +1,4 @@
{
"status" :"ok",
- "result" :
- {
- "result": "true"
- }
+ "result" : "true"
}
View
5 spec/fixtures/removeFromCollection.json
@@ -1,7 +1,4 @@
{
"status" :"ok",
- "result" :
- {
- "result": "true"
- }
+ "result" : "true"
}
View
5 spec/fixtures/removeFromPlaylist.json
@@ -1,7 +1,4 @@
{
"status" :"ok",
- "result" :
- {
- "result": "true"
- }
+ "result" : "true"
}
View
5 spec/fixtures/setAvailableOffline.json
@@ -1,7 +1,4 @@
{
"status" :"ok",
- "result" :
- {
- "result": "true"
- }
+ "result" : "true"
}
View
5 spec/fixtures/setPlaylistCollaborating.json
@@ -1,7 +1,4 @@
{
"status" :"ok",
- "result" :
- {
- "result": "true"
- }
+ "result" : "true"
}
View
5 spec/fixtures/setPlaylistCollaborationMode.json
@@ -1,7 +1,4 @@
{
"status" :"ok",
- "result" :
- {
- "result": "true"
- }
+ "result" : "true"
}
View
5 spec/fixtures/setPlaylistFields.json
@@ -1,7 +1,4 @@
{
"status" :"ok",
- "result" :
- {
- "result": "true"
- }
+ "result" : "true"
}
View
5 spec/fixtures/setPlaylistOrder.json
@@ -1,7 +1,4 @@
{
"status" :"ok",
- "result" :
- {
- "result": "true"
- }
+ "result" : "true"
}
View
6 spec/rdio_api/collection_spec.rb
@@ -20,7 +20,7 @@
it "should add track to Collection" do
results = @client.addToCollection(:keys => "t3802391")
- results.result.should eq("true")
+ results.should eq("true")
end
end
@@ -32,7 +32,7 @@
it "should remove track from Collection" do
results = @client.removeFromCollection(:keys => "t3802391")
- results.result.should eq("true")
+ results.should eq("true")
end
end
@@ -44,7 +44,7 @@
it "should return true with setting track available offline" do
results = @client.setAvailableOffline(:keys => "t1945474", :offline => "true")
- results.result.should eq("true")
+ results.should eq("true")
end
end
end
View
2 spec/rdio_api/playback_spec.rb
@@ -15,7 +15,7 @@
it "should return a Playback Token" do
results = @client.getPlaybackToken
- results.result.should eq("flkasdjFA5lkdjf90asdfli2l9cnlkasdj9")
+ results.should eq("flkasdjFA5lkdjf90asdfli2l9cnlkasdj9")
end
end
end
View
14 spec/rdio_api/playlists_spec.rb
@@ -30,7 +30,7 @@
it "should add to track to playlist" do
results = @client.addToPlaylist(:playlist => "p200057", :tracks => "t1945475")
- results.result.should eq("true")
+ results.should eq("true")
end
end
@@ -53,7 +53,7 @@
it "should return true(collaborating should be false)" do
results = @client.setPlaylistCollaborating(:playlist => "p200057", :collaborating => "false")
- results.result.should eq("true")
+ results.should eq("true")
end
end
@@ -65,7 +65,7 @@
it "should set collaboration mode to playlist followers and return true" do
results = @client.setPlaylistCollaborationMode(:playlist => "p200057", :mode => "2")
- results.result.should eq("true")
+ results.should eq("true")
end
end
@@ -78,7 +78,7 @@
it "should change Playlist fields" do
results = @client.setPlaylistFields(:playlist => "p200057", :name => "RdioApi RubyGem", :description => "A Test Playlist")
- results.result.should eq("true")
+ results.should eq("true")
end
end
@@ -90,7 +90,7 @@
it "should set new Playlist order " do
results = @client.setPlaylistOrder(:playlist => "p200057", :track => "t3483614, t1945474, t1945475")
- results.result.should eq("true")
+ results.should eq("true")
end
end
@@ -103,7 +103,7 @@
it "should remove track from Playlist" do
results = @client.removeFromPlaylist(:playlist => "p200057", :index => "2", :count => "1", :tracks => "t1945475")
- results.result.should eq("true")
+ results.should eq("true")
end
end
@@ -115,7 +115,7 @@
it "should delete the playlist" do
results = @client.deletePlaylist(:playlist => "p200057")
- results.result.should eq("true")
+ results.should eq("true")
end
end
end
View
4 spec/rdio_api/social_spec.rb
@@ -20,7 +20,7 @@
it "should add Friend" do
results = @client.addFriend(:user => "s12345")
- results.result.should eq("true")
+ results.should eq("true")
end
end
@@ -32,7 +32,7 @@
it "should remove Friend" do
results = @client.removeFriend(:user => "s12345")
- results.result.should eq("true")
+ results.should eq("true")
end
end

0 comments on commit 1973e85

Please sign in to comment.
Something went wrong with that request. Please try again.