Sha256: c940227aaf7fc06b287c1b48aa21ab485d62101a34b32714c44f887f75ca4e81

Contents?: true

Size: 973 Bytes

Versions: 9

Compression:

Stored size: 973 Bytes

Contents

require 'rails_helper'

RSpec.describe Withdraw, type: :model do
  fixtures :all

  it "should change circulation_status" do
    withdraw = FactoryBot.create(:withdraw)
    withdraw.item.circulation_status.name.should eq 'Removed'
    withdraw.item.use_restriction.name.should eq 'Not For Loan'
  end

  it "should not withdraw rented item" do
    withdraw = Withdraw.new(librarian: users(:librarian1))
    withdraw.item = items(:item_00013)
    withdraw.valid?.should be_falsy
  end

  it "should not withdraw reserved item" do
    reserve = FactoryBot.create(:reserve)
    withdraw = FactoryBot.build(:withdraw, item: reserve.manifestation.items.first)
    withdraw.valid?.should be_falsy
  end
end

# == Schema Information
#
# Table name: withdraws
#
#  id           :integer          not null, primary key
#  basket_id    :integer
#  item_id      :integer
#  librarian_id :integer
#  created_at   :datetime         not null
#  updated_at   :datetime         not null
#

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
enju_circulation-0.4.0.beta.4 spec/models/withdraw_spec.rb
enju_circulation-0.4.0.beta.3 spec/models/withdraw_spec.rb
enju_circulation-0.3.6 spec/models/withdraw_spec.rb
enju_circulation-0.4.0.beta.2 spec/models/withdraw_spec.rb
enju_circulation-0.4.0.beta.1 spec/models/withdraw_spec.rb
enju_circulation-0.3.5 spec/models/withdraw_spec.rb
enju_circulation-0.3.4 spec/models/withdraw_spec.rb
enju_circulation-0.3.3 spec/models/withdraw_spec.rb
enju_circulation-0.3.2 spec/models/withdraw_spec.rb