Add home page with playlists list and link to add a track
This commit is contained in:
11
spec/controllers/home_controller_spec.rb
Normal file
11
spec/controllers/home_controller_spec.rb
Normal 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
|
19
spec/views/home/index.html.haml_spec.rb
Normal file
19
spec/views/home/index.html.haml_spec.rb
Normal 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
|
@@ -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
|
||||
|
Reference in New Issue
Block a user