Skip to content

Commit

Permalink
Additional RSpec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SaravShah committed Nov 3, 2017
1 parent e289d36 commit 93ce5cf
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 1 deletion.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.keep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.keep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.keep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.keep
33 changes: 32 additions & 1 deletion spec/unit_tests/moab/storage_object_validator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@
expect(verification_array[7]).to eq(Moab::StorageObjectValidator::NO_XML_FILES =>"Version: v0006 Missing all required metadata files")
end
end
context 'under manifest directory' do
druid = 'cc000cc0000'
druid_path = 'spec/fixtures/bad_root01/bad_moab_storage_trunk/cc/000/cc/0000/cc000cc0000'
storage_obj = Moab::StorageObject.new(druid, druid_path)
storage_obj_validator = described_class.new(storage_obj)
verification_array = storage_obj_validator.validation_errors
it 'does not have signatureCatalog.xml' do
expect(verification_array[0]).to eq(Moab::StorageObjectValidator::NO_SIGNATURE_CATALOG => "Version: v0001 Missing signatureCatalog.xml")
end

it 'does not have manifestInventory.xml' do
expect(verification_array[1]).to eq(Moab::StorageObjectValidator::NO_MANIFEST_INVENTORY => "Version: v0002 Missing manifestInventory.xml")
end

end
it "has non contiguous version directories" do
druid = 'yy000yy0000'
druid_path = 'spec/fixtures/bad_root01/bad_moab_storage_trunk/yy/000/yy/0000/yy000yy0000'
Expand All @@ -67,13 +82,29 @@
verification_array = storage_obj_validator.validation_errors
expect(verification_array).to eq([{ Moab::StorageObjectValidator::VERSIONS_NOT_IN_ORDER =>"Should contain only sequential version directories. Current directories: [\"v0001\", \"v0003\", \"v0004\", \"v0006\"]" }])
end
it "has extra characters in version directory name" do
druid = 'aa000aa0000'
druid_path = 'spec/fixtures/bad_root01/bad_moab_storage_trunk/aa/000/aa/0000/aa000aa0000'
storage_obj = Moab::StorageObject.new(druid, druid_path)
storage_obj_validator = described_class.new(storage_obj)
verification_array = storage_obj_validator.validation_errors
expect(verification_array[0]).to eq(Moab::StorageObjectValidator::VERSION_DIR_BAD_FORMAT => "Version directory name not in 'v00xx' format")
end
it "incorrect items in path" do
druid = 'aa000aa0000'
druid_path = 'spec/fixtures/bad_root01/bad_moab_storage_trunk/bb/000/bb/0000/bb000bb0000'
storage_obj = Moab::StorageObject.new(druid, druid_path)
storage_obj_validator = described_class.new(storage_obj)
verification_array = storage_obj_validator.validation_errors
expect(verification_array[0]).to eq(Moab::StorageObjectValidator::INCORRECT_DIR => "Incorrect items in path")
end
it "has incorrect version directory name" do
druid = 'zz000zz0000'
druid_path = 'spec/fixtures/bad_root01/bad_moab_storage_trunk/zz/000/zz/0000/zz000zz0000'
storage_obj = Moab::StorageObject.new(druid, druid_path)
storage_obj_validator = described_class.new(storage_obj)
verification_array = storage_obj_validator.validation_errors
expect(verification_array).to eq [Moab::StorageObjectValidator::VERSION_DIR_BAD_FORMAT =>"Version directory name not in 'v00xx' format"]
expect(verification_array[0]).to eq(Moab::StorageObjectValidator::VERSION_DIR_BAD_FORMAT =>"Version directory name not in 'v00xx' format")
end
it "returns true when moab is in correct format" do
druid = 'bj103hs9687'
Expand Down

0 comments on commit 93ce5cf

Please sign in to comment.