spec/bagit_spec.rb in bagit-0.4.6 vs spec/bagit_spec.rb in bagit-0.5.0
- old
+ new
@@ -163,6 +163,33 @@
@bag.gc!
expect(File.exist?(File.dirname(File.join(@bag_path, "data", f)))).to be false
end
end
end
+
+ describe "bag with hidden files" do
+ before do
+ @sandbox = Sandbox.new
+
+ # make the bag
+ @bag_path = File.join @sandbox.to_s, "the_bag"
+ @bag = described_class.new @bag_path, {}, false, true
+
+ # add some files
+ @bag.add_file(".keep") { |io| io.puts "" }
+ @bag.add_file("test.txt") { |io| io.puts "testing testing" }
+ end
+
+ after do
+ @sandbox.cleanup!
+ end
+
+ describe "#bag_files" do
+ it "returns an array including non-hidden and hidden files" do
+ files = @bag.bag_files.map { |f| f.sub(File.join(@bag_path, "data", ""), "") }
+ expect(files).to be_a_kind_of(Array)
+ expect(files).not_to be_empty
+ expect(files).to eq([".keep", "test.txt"])
+ end
+ end
+ end
end