Skip to content

Commit

Permalink
Add link to edit track
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislo committed Aug 22, 2023
1 parent c628f32 commit 43dc0e7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/albums/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<ol>
<% @album.tracks.each_with_index do |track, index| %>
<li><%= index + 1 %>. <%= track.title %></li>
<li><%= index + 1 %>. <%= track.title %> <%= text_link_to 'Edit', edit_artist_album_track_url(track.artist, track.album, track) %></li>
<% end %>
</ol>

Expand Down
11 changes: 11 additions & 0 deletions test/system/tracks_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,15 @@ class TracksTest < ApplicationSystemTestCase

assert_text "2. #{@track.title}"
end

test 'editing a track' do
visit artist_album_url(@track.artist, @track.album)
assert_text "1. #{@track.title}"

click_on 'Edit'
fill_in 'Title', with: 'New title'
click_on 'Save'

assert_text '1. New title'
end
end

0 comments on commit 43dc0e7

Please sign in to comment.