Sha256: 2a14f9d7f03e99bd7df76d0489f3c410be20808206d998578347c179d31abcd9

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe CurationConcern do
  subject {CurationConcern}
  it 'can mint_a_pid' do
    subject.should respond_to(:mint_a_pid)
  end

  describe '.actor' do
    it 'finds an actor by for a GenericFile' do
      subject.actor(GenericFile.new, User.new, {}).should(
        be_kind_of(CurationConcern::GenericFileActor)
      )
    end

    it 'raise an exception if there is no actor' do
      expect {
        subject.actor("", User.new, {})
      }.to raise_error(NameError)
    end
  end

  describe '.attach_file' do
    let(:file) { Rack::Test::UploadedFile.new(__FILE__, 'text/plain', false) }
    let(:user) { FactoryGirl.create(:user) }
    let(:generic_file) { GenericFile.new }
    let(:curation_concern) { FactoryGirl.create_curation_concern(:mock_curation_concern, user) }
    it 'works with a string' do
      actor = CurationConcern.actor(generic_file, user, {batch_id: curation_concern.pid, file: file})
      actor.create!
      generic_file.content.content.should == file.read
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
curate-0.3.2 spec/services/curation_concern_spec.rb
curate-0.3.1 spec/services/curation_concern_spec.rb
curate-0.2.0 spec/services/curation_concern_spec.rb
curate-0.1.3 spec/services/curation_concern_spec.rb
curate-0.1.2 spec/services/curation_concern_spec.rb
curate-0.1.1 spec/services/curation_concern_spec.rb
curate-0.1.0 spec/services/curation_concern_spec.rb