spec/fetch_spec.rb in bagit-0.3.2 vs spec/fetch_spec.rb in bagit-0.3.4

- old
+ new

@@ -1,5 +1,6 @@ +# coding: utf-8 require 'spec_helper' describe "fetch.txt" do before(:each) do @@ -12,11 +13,11 @@ # add some files File.open('/dev/urandom') do |rio| 10.times do |n| - @bag.add_file("file-#{n}") { |io| io.write rio.read(16) } + @bag.add_file("file-#{n}-💩 ") { |io| io.write rio.read(16) } end end end @@ -33,24 +34,24 @@ path = File.join @bag_path, 'fetch.txt' @lines = File.open(path) { |io| io.readlines } end it "should not be empty" do - @lines.should_not be_empty + expect(@lines).not_to be_empty end it "should only contain lines of the format URL LENGTH FILENAME" do - @lines.each { |line| line.chomp.should =~ /^[^\s]+\s+(\d+|\-)\s+[^\s]+$/ } + @lines.each { |line| expect(line.chomp).to match(/^[^\s]+\s+(\d+|\-)\s+[^\s]+$/) } end it "should contain manifested files" do path = File.join @bag_path, 'manifest-sha1.txt' data = File.open(path) { |io| io.read } - data.should include('gnu.png') + expect(data).to include('gnu.png') end it "should be gone when fetch is complete" do @bag.fetch! - File.exist?(File.join(@bag_path, 'fetch.txt')).should_not be_true + expect(File.exist?(File.join(@bag_path, 'fetch.txt'))).not_to be true end end