Sha256: 7eeb98d086c7ce87b92024adfdba4413c90c046e66105d0b7cb17a751f00d020

Contents?: true

Size: 1.21 KB

Versions: 13

Compression:

Stored size: 1.21 KB

Contents

require 'rails_helper'

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

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

    assign(:reserves, Reserve.page(1))
    view.stub(:current_user).and_return(User.where(username: 'enjuadmin').first)
    view.stub(:filtered_params).and_return(ActionController::Parameters.new.permit(:query))
  end

  it "renders a list of reserves" do
    allow(view).to receive(:policy).and_return double(create?: true, update?: true, destroy?: true)
    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 = FactoryBot.create(:reserve, expired_at: nil)
    assign(:reserves, Reserve.page(2))
    allow(view).to receive(:policy).and_return double(create?: true, update?: true, destroy?: true)
    render
    rendered.should match /<td/
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
enju_circulation-0.3.11 spec/views/reserves/index.html.erb_spec.rb
enju_circulation-0.3.10 spec/views/reserves/index.html.erb_spec.rb
enju_circulation-0.3.9 spec/views/reserves/index.html.erb_spec.rb
enju_circulation-0.4.0.rc.1 spec/views/reserves/index.html.erb_spec.rb
enju_circulation-0.3.8 spec/views/reserves/index.html.erb_spec.rb
enju_circulation-0.3.7 spec/views/reserves/index.html.erb_spec.rb
enju_circulation-0.4.0.beta.4 spec/views/reserves/index.html.erb_spec.rb
enju_circulation-0.4.0.beta.3 spec/views/reserves/index.html.erb_spec.rb
enju_circulation-0.3.6 spec/views/reserves/index.html.erb_spec.rb
enju_circulation-0.4.0.beta.2 spec/views/reserves/index.html.erb_spec.rb
enju_circulation-0.4.0.beta.1 spec/views/reserves/index.html.erb_spec.rb
enju_circulation-0.3.5 spec/views/reserves/index.html.erb_spec.rb
enju_circulation-0.3.4 spec/views/reserves/index.html.erb_spec.rb