Add home page with playlists list and link to add a track

This commit is contained in:
Thibault Jouan
2011-07-27 19:34:59 +00:00
parent d452dde3ea
commit b39bc2d6da
9 changed files with 52 additions and 7 deletions

View File

@@ -0,0 +1,11 @@
require 'spec_helper'
describe HomeController do
describe 'GET index' do
it 'assigns all playlists as @playlists' do
playlist = Factory.create(:playlist)
get :index
assigns[:playlists].should == [playlist]
end
end
end

View File

@@ -0,0 +1,19 @@
require 'spec_helper'
describe 'home/index.html.haml' do
before do
assign :playlists, [
mock_model('Playlist', :name => 'Electro')
]
end
it 'displays a list of playlists' do
render
rendered.should have_selector('ul>li', :text => 'Electro')
end
it 'displays a link to add a track' do
render
rendered.should have_selector('a', :text => 'Add a track')
end
end

View File

@@ -21,9 +21,4 @@ describe 'playlists/index.html.haml' do
render
rendered.should have_selector('a', :text => 'Electro')
end
it 'displays a link to create a new track' do
render
rendered.should have_selector('a', :text => 'Add a track')
end
end