Skip to content

Commit

Permalink
Test for compatibility with hydra-pcdm and hydra-works
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingzumwalt committed Jun 5, 2015
1 parent b5a3f50 commit 262835c
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@ gemspec

group :development, :test do
gem 'byebug' unless ENV['TRAVIS']

# Not-Yet-Released Development dependencies
gem 'hydra-works', github: 'projecthydra-labs/hydra-works', ref: '013d817'
gem 'hydra-pcdm', github: 'projecthydra-labs/hydra-pcdm', ref: '30a9643'
gem 'active-fedora', github: 'projecthydra/active_fedora', ref:'57ac754'
gem 'activefedora-aggregation', github: 'projecthydra-labs/activefedora-aggregation', ref: 'eef02b0'

end
55 changes: 55 additions & 0 deletions spec/units/processor_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
require 'spec_helper'
require 'hydra/works'

describe Hydra::Derivatives::Processor do

before(:all) do
class IndirectContainerObject < ActiveFedora::Base
contains "content"
contains "thumbnail"
end

class DirectContainerObject < Hydra::Works::GenericFile::Base
end
# If we only want to test against hydra-pcdm and not hydra-works, we can use this:
# class DirectContainerObject < Hydra::PCDM::Object
# def original_file
# file_of_type(::RDF::URI("http://pcdm.org/OriginalFile"))
# end
#
# def thumbnail
# file_of_type(::RDF::URI("http://pcdm.org/ThumbnailImage"))
# end
# end
end

let(:object) { IndirectContainerObject.new }
let(:source_name) { 'content' }
let(:directives) { { thumb: "100x100>" } }

subject { Hydra::Derivatives::Processor.new(object, source_name, directives)}

describe "source_file" do
it "retrieves the specified source" do
expect(subject.source_file).to eq(object.content)
end
end

describe "output_file" do
it "retrieves the correct output file" do
expect(subject.output_file('thumbnail')).to eq(object.thumbnail)
end
end

describe "when files are directly contained by object (like files in a PCDM::Object)" do
let(:object) { DirectContainerObject.new }
let(:source_name) { 'original_file' }
before do
object.save
end
it "is able to find source_file and output_file" do
expect(subject.source_file).to eq(object.original_file)
expect(subject.output_file).to eq(object.thumbnail)
end
end
end

0 comments on commit 262835c

Please sign in to comment.