Sha256: ca44832bd9912826a9227ca718df6c4ec58a5607db4b7f50166ae920afcf1929

Contents?: true

Size: 1.1 KB

Versions: 18

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe AuditJob do
  before do
    @user = FactoryGirl.find_or_create(:user)
    @inbox = @user.mailbox.inbox
    GenericFile.any_instance.should_receive(:characterize_if_changed).and_yield
    GenericFile.any_instance.stub(:terms_of_service).and_return('1')
    @file = GenericFile.new
    @file.apply_depositor_metadata(@user)
    @file.save
    @ds = @file.datastreams.first
  end
  after do
    @file.delete
  end
  describe "passing audit" do
    it "should not send passing mail" do
      ActiveFedora::RelsExtDatastream.any_instance.stub(:dsChecksumValid).and_return(true)
      AuditJob.new(@file.pid, @ds[0], @ds[1].versionID).run
      @inbox = @user.mailbox.inbox
      @inbox.count.should == 0
    end
  end
  describe "failing audit" do
    it "should send failing mail" do
      ActiveFedora::RelsExtDatastream.any_instance.stub(:dsChecksumValid).and_return(false)
      AuditJob.new(@file.pid, @ds[0], @ds[1].versionID).run
      @inbox = @user.mailbox.inbox
      @inbox.count.should == 1
      @inbox.each { |msg| msg.last_message.subject.should == AuditJob::FAIL }
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
sufia-3.7.2 spec/models/audit_job_spec.rb
sufia-3.7.1 spec/models/audit_job_spec.rb
sufia-3.7.0 spec/models/audit_job_spec.rb
sufia-3.6.1 spec/models/audit_job_spec.rb
sufia-3.6.0 spec/models/audit_job_spec.rb
sufia-3.5.0 spec/models/audit_job_spec.rb
sufia-3.4.0 spec/models/audit_job_spec.rb
sufia-3.4.0.rc4 spec/models/audit_job_spec.rb
sufia-3.4.0.rc3 spec/models/audit_job_spec.rb
sufia-3.3.1 spec/models/audit_job_spec.rb
sufia-3.4.0.rc2 spec/models/audit_job_spec.rb
sufia-3.4.0.rc1 spec/models/audit_job_spec.rb
sufia-3.3.0 spec/models/audit_job_spec.rb
sufia-3.2.1 spec/models/audit_job_spec.rb
sufia-3.1.3 spec/models/audit_job_spec.rb
sufia-3.1.2 spec/models/audit_job_spec.rb
sufia-3.1.1 spec/models/audit_job_spec.rb
sufia-3.1.0 spec/models/audit_job_spec.rb