Sha256: 91d515f5684fedee1035295f66d203f6669aa6f004a9676046ef66a05a644131

Contents?: true

Size: 1.32 KB

Versions: 8

Compression:

Stored size: 1.32 KB

Contents

require 'rails_helper'

describe Item do
  # pending "add some examples to (or delete) #{__FILE__}"
  fixtures :all

  it "should be rent" do
    items(:item_00001).rent?.should be_truthy
  end

  it "should not be rent" do
    items(:item_00010).rent?.should be_falsy
  end

  it "should be checked out" do
    items(:item_00010).checkout!(users(:admin)).should be_truthy
    items(:item_00010).circulation_status.name.should eq 'On Loan'
  end

  it "should be checked in" do
    items(:item_00001).checkin!.should be_truthy
    items(:item_00001).circulation_status.name.should eq 'Available On Shelf'
  end

  it "should be retained" do
    old_count = MessageRequest.count
    items(:item_00013).retain(users(:librarian1)).should be_truthy
    items(:item_00013).reserves.first.current_state.should eq 'retained'
    MessageRequest.count.should eq old_count + 4
  end

  it "should not be checked out when it is reserved" do
    items(:item_00012).available_for_checkout?.should be_falsy
  end

  it "should not be able to checkout a removed item" do
    Item.for_checkout.include?(items(:item_00023)).should be_falsy
  end

  it "should delete lending policies" do
    item = items(:item_00001)
    item.checkout_type = CheckoutType.find_by(name: 'serial')
    item.save
    item.reload
    item.lending_policies.count.should eq 0
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
enju_circulation-0.3.11 spec/models/item_spec.rb
enju_circulation-0.3.10 spec/models/item_spec.rb
enju_circulation-0.3.9 spec/models/item_spec.rb
enju_circulation-0.3.8 spec/models/item_spec.rb
enju_circulation-0.3.7 spec/models/item_spec.rb
enju_circulation-0.3.6 spec/models/item_spec.rb
enju_circulation-0.3.5 spec/models/item_spec.rb
enju_circulation-0.3.4 spec/models/item_spec.rb