Skip to content

Commit

Permalink
Merge pull request #361 from blackcandy-org/api-response
Browse files Browse the repository at this point in the history
  • Loading branch information
aidewoode authored Mar 18, 2024
2 parents 0627416 + e513215 commit e294447
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
json.partial! "api/v1/songs/song", song: @song
12 changes: 10 additions & 2 deletions test/controllers/api/v1/current_playlist/songs_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,18 @@ class Api::V1::CurrentPlaylist::SongsControllerTest < ActionDispatch::Integratio
end

test "should remove songs from playlist" do
delete api_v1_current_playlist_song_url(id: 1), headers: api_token_header(@user)
delete api_v1_current_playlist_song_url(id: 1), as: :json, headers: api_token_header(@user)
response = @response.parsed_body

assert_response :success
assert_equal 1, response["id"]
assert_equal [2, 3], @playlist.reload.song_ids

delete api_v1_current_playlist_song_url(id: 3), headers: api_token_header(@user)
delete api_v1_current_playlist_song_url(id: 3), as: :json, headers: api_token_header(@user)
response = @response.parsed_body

assert_response :success
assert_equal 3, response["id"]
assert_equal [2], @playlist.reload.song_ids
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Api::V1::FavoritePlaylist::SongsControllerTest < ActionDispatch::Integrati

assert_response :success
assert_equal 2, response["id"]
assert_not response["is_favorited"]
assert_equal [], @playlist.reload.song_ids
end

Expand Down

0 comments on commit e294447

Please sign in to comment.