scube-server/spec/controllers/home_controller_spec.rb
Thibault Jouan 7bf4d4c5f9 Add authentication and User model
* Add User model
* Add SessionsController
* Add password authentication on User
* Request authentication for all actions except sign in
* Add some helpers for ApplicationController
* Update features to work with mandatory authentication
2011-08-06 23:04:36 +00:00

23 lines
589 B
Ruby

require 'spec_helper'
describe HomeController do
before do
controller.current_user = Factory.create(:user)
end
describe 'GET index' do
it 'assigns all playlists as @playlists' do
playlist = Factory.create(:playlist)
get :index
assigns[:playlists].should == [playlist]
end
it 'assigns latest tracks as @tracks' do
track1 = Factory.create(:track, :created_at => '2011-07-27 19:13:42')
track2 = Factory.create(:track, :created_at => '2011-07-27 19:58:57')
get :index
assigns[:tracks].should == Track.latest
end
end
end