Sha256: 354f4344e6d8cb1000e205d74d8a2821278ed08900c65b09e5cc3098bc3ea10b

Contents?: true

Size: 1.31 KB

Versions: 4

Compression:

Stored size: 1.31 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(format: :txt, role: "Guest")
    csv = CSV.parse(lines, headers: true, col_sep: "\t")
    expect(csv["use_restriction"].compact).to be_empty

    lines = Manifestation.export(format: :txt, 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

4 entries across 4 versions & 1 rubygems

Version Path
enju_circulation-0.4.0.beta.4 spec/models/manifestation_spec.rb
enju_circulation-0.4.0.beta.3 spec/models/manifestation_spec.rb
enju_circulation-0.4.0.beta.2 spec/models/manifestation_spec.rb
enju_circulation-0.4.0.beta.1 spec/models/manifestation_spec.rb