Sha256: f71a59a5ed50746a73c6f2f17de7c5b20012fae85cfc520cd2b083a941052f23

Contents?: true

Size: 1.27 KB

Versions: 14

Compression:

Stored size: 1.27 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
#  updated_at   :datetime
#  lock_version :integer          default(0), not null
#

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
enju_circulation-0.2.0.beta.2 spec/models/checkin_spec.rb
enju_circulation-0.2.0.beta.1 spec/models/checkin_spec.rb
enju_circulation-0.1.2 spec/models/checkin_spec.rb
enju_circulation-0.1.1 spec/models/checkin_spec.rb
enju_circulation-0.1.0 spec/models/checkin_spec.rb
enju_circulation-0.1.0.pre49 spec/models/checkin_spec.rb
enju_circulation-0.1.0.pre48 spec/models/checkin_spec.rb
enju_circulation-0.1.0.pre47 spec/models/checkin_spec.rb
enju_circulation-0.1.0.pre46 spec/models/checkin_spec.rb
enju_circulation-0.1.0.pre45 spec/models/checkin_spec.rb
enju_circulation-0.1.0.pre44 spec/models/checkin_spec.rb
enju_circulation-0.1.0.pre43 spec/models/checkin_spec.rb
enju_circulation-0.1.0.pre42 spec/models/checkin_spec.rb
enju_circulation-0.1.0.pre41 spec/models/checkin_spec.rb