Sha256: 708d0eae8af72826641b45d36e16b58a498e9c918709cd86d408e2e1fa90aff5

Contents?: true

Size: 932 Bytes

Versions: 3

Compression:

Stored size: 932 Bytes

Contents

require 'spec_helper'

# Scanned Media Metadata Spec Tests
RSpec.describe NewspaperWorks::ScannedMediaMetadata do
  class ScannedMediaWork < ActiveFedora::Base
    include ::Hyrax::WorkBehavior
    include NewspaperWorks::ScannedMediaMetadata
    include ::Hyrax::BasicMetadata
  end

  let(:work) { ScannedMediaWork.new }

  it 'creates work using mixin' do
    expect(work).to be_an_instance_of(ScannedMediaWork)
  end

  it 'has expected properties' do
    expect(work).to respond_to(:text_direction)
    expect(work).to respond_to(:page_number)
    expect(work).to respond_to(:section)
  end

  it 'work can set/get properties' do
    work.section = 'foo'
    expect(work.section).to include 'foo'
  end

  it 'work using mixin saves' do
    work.title = ['label able label']
    expect(work.id).to be_nil
    work.save!
    expect(work.id).not_to be_nil
    expect(ScannedMediaWork.all.map(&:id)).to include(work.id)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newspaper_works-1.0.1 spec/models/concerns/newspaper_works/scanned_media_metadata_spec.rb
newspaper_works-1.0.0 spec/models/concerns/newspaper_works/scanned_media_metadata_spec.rb
newspaper_works-0.1.0 spec/models/concerns/newspaper_works/scanned_media_metadata_spec.rb