Sha256: e861404d4556ebad5b8367a341a4c5af8cad1bfd5b2165f6acd0a8ef57921fcb
Contents?: true
Size: 1.78 KB
Versions: 1
Compression:
Stored size: 1.78 KB
Contents
# Copyright © 2012 The Pennsylvania State University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'spec_helper' describe AuditJob do before(:all) do @user = FactoryGirl.find_or_create(:user) @inbox = @user.mailbox.inbox GenericFile.any_instance.expects(:characterize_if_changed).yields GenericFile.any_instance.stubs(:terms_of_service).returns('1') @file = GenericFile.new @file.apply_depositor_metadata(@user.user_key) @file.save @ds = @file.datastreams.first end after(:all) do # clear any existing messages @inbox.each(&:delete) @user.delete @file.delete end describe "passing audit" do it "should not send passing mail" do ActiveFedora::RelsExtDatastream.any_instance.stubs(:dsChecksumValid).returns(true) Resque.enqueue(AuditJob, @file.pid, @ds[0], @ds[1].versionID) @inbox = @user.mailbox.inbox @inbox.count.should == 0 end end describe "failing audit" do it "should send failing mail" do ActiveFedora::RelsExtDatastream.any_instance.stubs(:dsChecksumValid).returns(false) Resque.enqueue(AuditJob, @file.pid, @ds[0], @ds[1].versionID) @inbox = @user.mailbox.inbox @inbox.count.should == 1 @inbox.each { |msg| msg.last_message.subject.should == AuditJob::FAIL } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sufia-0.0.1.pre2 | spec/models/audit_job_spec.rb |