1 require File.dirname(__FILE__) + '/../spec_helper'
3 describe "ApplicationHelper with a current song" do
4 helper_name :application
6 it "should give the current song a current CSS class" do
7 @song = mock_model(Song)
8 song_class(@song).should include('current')
11 it "should not give a non-current song a current CSS class" do
12 @song = mock_model(Song)
13 song_class(mock_model(Song)).should_not include('current')
17 describe "ApplicationHelper without a current song" do
18 helper_name :application
20 it "should not give a current CSS class if there is no current song" do
21 song_class(mock_model(Song)).should_not include('current')
25 describe "ApplicationHelper with a current show" do
26 helper_name :application
28 it "should give the current show a current CSS class" do
29 @show = mock_model(Show)
30 show_class(@show).should include('current')
33 it "should not give a non-current show a current CSS class" do
34 @show = mock_model(Show)
35 show_class(mock_model(Show)).should_not include('current')
39 describe "ApplicationHelper without a current show" do
40 helper_name :application
42 it "should not give a current CSS class if there is no current show" do
43 show_class(mock_model(Show)).should_not include('current')
47 describe "ApplicationHelper logged in" do
48 helper_name :application
51 @songs = mock("songs_proxy")
52 @shows = mock("shows_proxy")
53 @user = mock_model(User, :songs => @songs, :shows => @shows)
54 stub!(:logged_in?).and_return(true)
55 stub!(:current_user).and_return(@user)
58 it "should get a list of all the user's songs" do
59 @songs.should_receive(:find).and_return(["a song"]) # who cares if it returns a string
60 all_songs.size.should == 1
63 it "should get a list of all the user's shows" do
64 @shows.should_receive(:find).and_return(["a show"]) # again, who cares?
65 all_shows.size.should == 1
69 describe "ApplicationHelper logged out" do
70 helper_name :application
73 stub!(:logged_in?).and_return(false)
76 it "should retrieve an empty list of songs" do
77 all_songs.size.should == 0
80 it "should retrieve an empty list of shows" do
81 all_shows.size.should == 0