1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require File.dirname(__FILE__) + '/../../spec_helper'

describe "/adverts/_advert.rhtml" do
  # include AdvertsHelper

  before do
    advert = mock_model(Advert)
    advert.should_receive(:id).and_return("123")
    advert.should_receive(:title).and_return("AdvertTitle")
    advert.should_receive(:description).and_return("Description")

    assigns[:advert] = advert
    
  end

  it "should display an advert" do
    
    render "/adverts/_advert.rhtml"       
    
    response.should have_tag('div#advert_123') do    
      with_tag('h3', 'AdvertTitle')
      with_tag('p', 'Description')
    end
        
  end
  
end