Implement playlist edit feature

* Display playlists as links in index
* Move playlist form in a partial
This commit is contained in:
Thibault Jouan
2011-07-12 11:34:40 +00:00
parent 33f979b573
commit 301205d3f0
10 changed files with 98 additions and 13 deletions

View File

@@ -0,0 +1,27 @@
require 'spec_helper'
describe 'playlists/edit.html.haml' do
let(:playlist) do
mock_model('Playlist').as_new_record.as_null_object
end
before do
assign :playlist, playlist
end
it 'renders a form to edit a playlist' do
render
rendered.should \
have_selector("form[method=post][action='#{playlists_path}']")
rendered.should have_selector('input[type=submit]')
end
it 'renders a text field with a label for the playlists name' do
playlist.stub(:name => 'Electro')
render
rendered.should \
have_selector("input[type=text][name='playlist[name]'][value=Electro]")
rendered.should \
have_selector("label[for=playlist_name]", :text => 'Name')
end
end