Skip to content

Commit

Permalink
Merge e98168f into 4018f78
Browse files Browse the repository at this point in the history
  • Loading branch information
SaravShah committed Sep 13, 2018
2 parents 4018f78 + e98168f commit e9ae7bf
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 273 deletions.
171 changes: 0 additions & 171 deletions app/lib/bundle_context_temporary.rb

This file was deleted.

83 changes: 0 additions & 83 deletions spec/lib/bundle_context_temporary_spec.rb

This file was deleted.

10 changes: 5 additions & 5 deletions spec/lib/pre_assembly/bundle_spec.rb
@@ -1,8 +1,8 @@
RSpec.describe PreAssembly::Bundle do
let(:md5_regex) { /^[0-9a-f]{32}$/ }
let(:revs_context) { context_from_proj_ar_model(:proj_revs)}
let(:revs_context) { bundle_context_from_hash(:proj_revs)}
let(:rumsey_context) do
context_from_proj_ar_model(:proj_rumsey).tap do |c|
bundle_context_from_hash(:proj_rumsey).tap do |c|
c.manifest_cols[:object_container] = 'folder'
allow(c).to receive(:path_in_bundle).with(any_args).and_call_original
allow(c).to receive(:path_in_bundle).with("manifest.csv").and_return('spec/test_data/bundle_input_e/manifest_of_3.csv')
Expand All @@ -17,7 +17,7 @@
allow(RestClient).to receive(:post).with(a_string_matching(exp_workflow_svc_url), {}).and_return(instance_double(RestClient::Response, code: 200))
end
it 'runs images_jp2_tif cleanly using images_jp2_tif.yaml for options' do
bc = context_from_proj_ar_model('images_jp2_tif')
bc = bundle_context_from_hash('images_jp2_tif')
# need to delete progress log to ensure this test doesn't skip objects already run
File.delete(bc.progress_log_file) if File.exist?(bc.progress_log_file)

Expand Down Expand Up @@ -60,7 +60,7 @@

describe '#digital_objects' do
it "finds the correct number of objects" do
b = bundle_setup_ar_model(:folder_manifest)
b = bundle_setup(:folder_manifest)
b.manifest_rows.each {|row| row.merge!("object" => row["folder"]) }

expect(b.digital_objects.size).to eq(3)
Expand Down Expand Up @@ -292,7 +292,7 @@
"cp898cs9946/descMetadata.xml",
],
}.each do |proj, files|
b = described_class.new(context_from_proj_ar_model(proj))
b = described_class.new(bundle_context_from_hash(proj))
exp_files = files.map { |f| b.path_in_bundle f }
expect(b.find_files_recursively(b.bundle_dir).sort).to eq(exp_files)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/services/discover_report_spec.rb
@@ -1,7 +1,7 @@
require 'rails_helper'

RSpec.describe DiscoveryReport do
let(:bundle) { bundle_setup_ar_model(:proj_revs) }
let(:bundle) { bundle_setup(:proj_revs) }
subject(:report) { described_class.new(bundle) }

before do
Expand Down
14 changes: 2 additions & 12 deletions spec/support/bundle_setup.rb
@@ -1,28 +1,18 @@
# @param [#to_s] proj basename of YAML fixture file
# @return [PreAssembly::Bundle]
def bundle_setup(proj)
PreAssembly::Bundle.new(context_from_proj(proj))
end

def bundle_setup_ar_model(proj)
PreAssembly::Bundle.new(context_from_proj_ar_model(proj))
PreAssembly::Bundle.new(bundle_context_from_hash(proj))
end

def hash_from_proj(proj)
filename = "spec/test_data/project_config_files/#{proj}.yaml"
YAML.load(File.read(filename)).merge('config_filename' => filename)
end

def context_from_proj(proj)
BundleContextTemporary.new(hash_from_proj(proj))
end

def noko_doc(x)
Nokogiri.XML(x) { |conf| conf.default_xml.noblanks }
end


def context_from_proj_ar_model(proj)
def bundle_context_from_hash(proj)
user = User.create(sunet_id: "Jdoe")

cmc = hash_from_proj(proj)["content_md_creation"]["style"]
Expand Down
2 changes: 1 addition & 1 deletion spec/views/discovery_report/show.text.erb_spec.rb
@@ -1,5 +1,5 @@
RSpec.describe 'discovery_report/show.text.erb' do
let(:bundle) { bundle_setup_ar_model(:proj_revs) }
let(:bundle) { bundle_setup(:proj_revs) }
subject(:report) { DiscoveryReport.new(bundle) }

before do
Expand Down

0 comments on commit e9ae7bf

Please sign in to comment.