Sha256: 39e62aaf060d04716eb3a3b76544ef0036a86e4e91b2c47bb6d357fb1bdf09e7

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

require 'rails_helper'

describe Manifestation, solr: true do
  fixtures :all

  it "should be reserved" do
    manifestations(:manifestation_00007).is_reserved_by?(users(:admin)).should be_truthy
  end

  it "should not be reserved" do
    manifestations(:manifestation_00007).is_reserved_by?(users(:user1)).should be_falsy
  end

  it "should not be reserved it it has no item" do
    manifestations(:manifestation_00008).is_reservable_by?(users(:admin)).should be_falsy
  end

  it "should not export use_restriction for Guest" do
    manifestation = FactoryBot.create(:manifestation)
    use_restriction = UseRestriction.find(1)
    item = FactoryBot.create(:item, manifestation: manifestation, use_restriction: use_restriction)
    lines = Manifestation.export(role: "Guest")
    csv = CSV.parse(lines, headers: true, col_sep: "\t")
    expect(csv["use_restriction"].compact).to be_empty

    lines = Manifestation.export(role: "Administrator")
    csv = CSV.parse(lines, headers: true, col_sep: "\t")
    expect(csv["use_restriction"].compact).not_to be_empty
  end

  it "should respond to is_checked_out_by?" do
    manifestations(:manifestation_00001).is_checked_out_by?(users(:admin)).should be_truthy
    manifestations(:manifestation_00001).is_checked_out_by?(users(:librarian2)).should be_falsy
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
enju_circulation-0.4.0.rc.1 spec/models/manifestation_spec.rb