Sha256: 5e41823fed7dbaf3ef1d2d8e3d2732fef2fd0beb7e0a52f0f58f231d80ff4f0b

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe "open_conference_ware/tracks/index.html.erb" do
  include OpenConferenceWare::TracksHelper
  
  before(:each) do
    @event = stub_current_event!

    @tracks = [
      stub_model(Track,
        id: 2,
        title: "value for title",
        event: @event
      ),
      stub_model(Track,
        id: 3,
        title: "value for title",
        event: @event
      )
    ]
    assign(:tracks, @tracks)
  end

  describe "anonymous" do
    before do
      view.stub(:admin?).and_return(false)
    end

    it "should render list" do
      render
      rendered.should have_selector("h3", text: "value for title".to_s, count: 2)
    end
  end

  describe "admin" do
    fixtures :all

    before(:each) do
      view.stub(:admin?).and_return(true)
      render
    end

    it "should render list" do
      rendered.should have_selector("h3", text: "value for title".to_s, count: 2)
    end

    it "should render new link" do
      rendered.should have_selector("a[href='#{new_track_path}']")
    end

    it "should render edit links" do
      rendered.should have_selector("a[href='#{edit_track_path(@tracks.first)}']")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
open_conference_ware-1.0.0.pre1 spec/views/open_conference_ware/tracks/index.html.erb_spec.rb