spec/unit/imap/backup/account/folder_spec.rb in imap-backup-3.1.0 vs spec/unit/imap/backup/account/folder_spec.rb in imap-backup-3.2.0

- old
+ new

@@ -1,10 +1,10 @@ # rubocop:disable RSpec/PredicateMatcher describe Imap::Backup::Account::Folder do - FOLDER_NAME = "Gelöscht" - ENCODED_FOLDER_NAME = "Gel&APY-scht" + FOLDER_NAME = "Gelöscht".freeze + ENCODED_FOLDER_NAME = "Gel&APY-scht".freeze subject { described_class.new(connection, FOLDER_NAME) } let(:imap) do instance_double( @@ -99,9 +99,26 @@ context "when the response doesn't have RFC822" do let(:attributes) { {} } it "is nil" do expect(subject.fetch(123)).to be_nil + end + end + + context "when the first fetch_uid attempts fail" do + before do + outcomes = [-> { raise EOFError }, -> { [fetch_data_item] }] + allow(imap).to receive(:uid_fetch) { outcomes.shift.call } + end + + it "retries" do + subject.fetch(123) + + expect(imap).to have_received(:uid_fetch).twice + end + + it "succeeds" do + subject.fetch(123) end end end describe "#folder" do