Sha256: 51eaf0ec5d122fadd4273bc54126f66c27dbdfbc60fd47139d33ca3b85aac3ce

Contents?: true

Size: 953 Bytes

Versions: 5

Compression:

Stored size: 953 Bytes

Contents

require 'spec_helper'

describe "reserves/index" do
  fixtures :users, :roles, :user_has_roles, :reserves

  before(:each) do
    view.extend EnjuLeaf::EnjuLeafHelper

    assign(:reserves, Reserve.page(1))
    view.stub(:current_user).and_return(User.where(username: 'enjuadmin').first)
  end

  it "renders a list of reserves" do
    render
    # Run the generator again with the --webrat flag if you want to use webrat matchers
    assert_select "tr>td:nth-child(1)", :text => reserves(:reserve_00001).id.to_s
    assert_select "tr>td:nth-child(2)", :text => /#{reserves(:reserve_00001).user.username}/
    assert_select "tr>td:nth-child(2)", :text => /#{reserves(:reserve_00002).manifestation.original_title}/
  end

  it "renders a list of reserves when a reserve does not have expired_at" do
    reserve = FactoryGirl.create(:reserve, :expired_at => nil)
    assign(:reserves, Reserve.page(2))
    render
    rendered.should match /<td/
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
enju_circulation-0.1.2 spec/views/reserves/index.html.erb_spec.rb
enju_circulation-0.1.1 spec/views/reserves/index.html.erb_spec.rb
enju_circulation-0.1.0 spec/views/reserves/index.html.erb_spec.rb
enju_circulation-0.1.0.pre49 spec/views/reserves/index.html.erb_spec.rb
enju_circulation-0.1.0.pre48 spec/views/reserves/index.html.erb_spec.rb