Sha256: 837076fdae09632e3b46e38a334a34a80fd81aa88718b50ec8384fcc31fb64a3

Contents?: true

Size: 1.24 KB

Versions: 33

Compression:

Stored size: 1.24 KB

Contents

# -*- encoding: utf-8 -*-
require 'spec_helper'

describe Checkin do
  fixtures :all

  before(:each) do
    @basket = Basket.new
    @basket.user = users(:librarian1)
    @basket.save
  end

  it "should save checkout history if save_checkout_history is true" do
    user = users(:user1)
    checkouts_count = user.checkouts.count
    checkin = Checkin.new
    checkin.item = user.checkouts.not_returned.first.item
    checkin.basket = @basket
    #checkin.item_identifier = checkin.item.item_identifier
    checkin.save!
    checkin.item_checkin(user)
    user.checkouts.count.should eq checkouts_count
  end

  it "should not save checkout history if save_checkout_history is false" do
    user = users(:librarian1)
    checkouts_count = user.checkouts.count
    checkin = Checkin.new
    checkin.item = user.checkouts.not_returned.first.item
    checkin.basket = @basket
    checkin.save!
    checkin.item_checkin(user)
    user.checkouts.count.should eq checkouts_count - 1
  end
end
# == Schema Information
#
# Table name: checkins
#
#  id           :integer         not null, primary key
#  item_id      :integer         not null
#  librarian_id :integer
#  basket_id    :integer
#  created_at   :datetime        not null
#  updated_at   :datetime        not null
#

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
enju_circulation-0.1.0.pre7 spec/models/checkin_spec.rb
enju_circulation-0.1.0.pre6 spec/models/checkin_spec.rb
enju_circulation-0.1.0.pre5 spec/models/checkin_spec.rb
enju_circulation-0.1.0.pre4 spec/models/checkin_spec.rb
enju_circulation-0.1.0.pre3 spec/models/checkin_spec.rb
enju_circulation-0.1.0.pre2 spec/models/checkin_spec.rb
enju_circulation-0.1.0.pre spec/models/checkin_spec.rb
enju_circulation-0.0.71 spec/models/checkin_spec.rb
enju_circulation-0.0.70 spec/models/checkin_spec.rb
enju_circulation-0.0.69 spec/models/checkin_spec.rb
enju_circulation-0.0.68 spec/models/checkin_spec.rb
enju_circulation-0.0.67 spec/models/checkin_spec.rb
enju_circulation-0.0.66 spec/models/checkin_spec.rb
enju_circulation-0.0.65 spec/models/checkin_spec.rb
enju_circulation-0.0.64 spec/models/checkin_spec.rb
enju_circulation-0.0.63 spec/models/checkin_spec.rb
enju_circulation-0.0.62 spec/models/checkin_spec.rb
enju_circulation-0.0.61 spec/models/checkin_spec.rb
enju_circulation-0.0.60 spec/models/checkin_spec.rb
enju_circulation-0.0.59 spec/models/checkin_spec.rb