Skip to content

Commit

Permalink
Fix BagAdapter references
Browse files Browse the repository at this point in the history
  • Loading branch information
ssciolla committed Aug 5, 2024
1 parent d24709d commit be6cd9e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/bag_courier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def deliver
begin
track!(status: BagStatus::BAGGING)
bag_path = File.join(@working_dir, @bag_id.to_s)
bag = BagAdapter::BagAdapter.new(bag_path, @detect_hidden)
bag = BagAdapter::BagAdapter.new(target_dir: bag_path, detect_hidden: @detect_hidden)

track!(status: BagStatus::COPYING)
logger.measure_info("Copied data for bag #{@bag_id} in #{@working_dir}.") do
Expand Down
4 changes: 3 additions & 1 deletion test/test_bag_courier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ def setup
FileUtils.rm_r(@test_dir_path) if File.exist?(@test_dir_path)
FileUtils.mkdir_p([@test_dir_path, @prep_path, @export_path, @package_path])
@detect_hidden = true
innerbag = BagAdapter::BagAdapter.new(@package_path, @detect_hidden)
innerbag = BagAdapter::BagAdapter.new(
target_dir: @package_path, detect_hidden: @detect_hidden
)

File.write(
File.join(@package_path, "data", "something.txt"),
Expand Down
32 changes: 23 additions & 9 deletions test/test_bag_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@
file.puts "Some sample text for testing inner bag"
end
@detect_hidden_no = false
@innerbag = BagAdapter::BagAdapter.new(@data_dir_path, @detect_hidden_no)
@innerbag = BagAdapter::BagAdapter.new(
target_dir: @data_dir_path, detect_hidden: @detect_hidden_no)
@innerbag.add_manifests

@bag = BagAdapter::BagAdapter.new(@test_dir_path, @detect_hidden_no)
@bag = BagAdapter::BagAdapter.new(
target_dir: @test_dir_path, detect_hidden: @detect_hidden_no
)
@test_data_dir = @bag.data_dir
@bag.add_manifests
end
Expand Down Expand Up @@ -80,15 +83,18 @@
file.puts "Some sample text for testing inner bag"
end
@detect_hidden_yes = true
@innerbag = BagAdapter::BagAdapter.new(@data_dir_path, @detect_hidden_yes)
@innerbag = BagAdapter::BagAdapter.new(
target_dir: @data_dir_path, detect_hidden: @detect_hidden_yes
)
@innerbag.add_manifests

@bag = BagAdapter::BagAdapter.new(@test_dir_path, @detect_hidden_yes)
@bag = BagAdapter::BagAdapter.new(
target_dir: @test_dir_path, detect_hidden: @detect_hidden_yes)
@test_data_dir = @bag.data_dir
@bag.add_manifests
end

it "returns true if the bag is valid" do
it "returns true if the bag is valid" do
result = InnerBagValidator.new(@inner_bag_path, @detect_hidden_yes).validate(@test_data_dir)
assert(result)
end
Expand Down Expand Up @@ -157,10 +163,14 @@
file.write(@txt_file_content)
end

@innerbag = BagAdapter::BagAdapter.new(@data_dir_path, @detect_hidden_yes)
@innerbag = BagAdapter::BagAdapter.new(
target_dir: @data_dir_path, detect_hidden: @detect_hidden_yes
)
@innerbag.add_manifests

@bag = BagAdapter::BagAdapter.new(@test_dir_path, @detect_hidden_yes)
@bag = BagAdapter::BagAdapter.new(
target_dir: @test_dir_path, detect_hidden: @detect_hidden_yes
)
@test_data_dir = @bag.data_dir
@bag.add_manifests
end
Expand Down Expand Up @@ -234,10 +244,14 @@
file.write(@txt_file_content)
end

@innerbag = BagAdapter::BagAdapter.new(@data_dir_path, @detect_hidden_no)
@innerbag = BagAdapter::BagAdapter.new(
target_dir: @data_dir_path, detect_hidden: @detect_hidden_no
)
@innerbag.add_manifests

@bag = BagAdapter::BagAdapter.new(@test_dir_path, @detect_hidden_no)
@bag = BagAdapter::BagAdapter.new(
target_dir: @test_dir_path, detect_hidden: @detect_hidden_no
)
@test_data_dir = @bag.data_dir
@bag.add_manifests
end
Expand Down

0 comments on commit be6cd9e

Please sign in to comment.