The code is now completely covered in specs
[lyrix.git] / spec / views / songs / show_view_spec.rb
blob7c4897fe2eced8f8619534ef9f1b225844b8a0d0
1 require File.dirname(__FILE__) + '/../../spec_helper'
3 describe "/songs/show" do
4   before do
5     @song = mock_model(Song, :title => 'test song', :artist => '')
6     
7     @slides = 'first<br/>test<br/>test<hr />second<br/>test<br/>test<hr />third<br/>test<br/>test'
8     
9     @controller.template.stub!(:slides_for_song).and_return(@slides)
10   end
11   
12   it "should show a heading with the song title" do
13     assigns[:song] = @song
14     render '/songs/show'
15     response.should have_tag('h1', 'test song')
16   end
17   
18   it "should show a heading with the song artist" do
19     @song.stub!(:artist).and_return('test artist')
20     assigns[:song] = @song
21     render '/songs/show'
22     response.should have_tag('h2', 'test artist')
23   end
24   
25   it "should not contain a heading for artist if artist is blank" do
26     assigns[:song] = @song
27     render '/songs/show'
28     response.should_not have_tag('h2')
29   end
30 end