Sha256: 0be4e3bb97a82200caf30ce3fdde65aed1e04744555fd1b7c2e88af3c76234b4
Contents?: true
Size: 1.21 KB
Versions: 5
Compression:
Stored size: 1.21 KB
Contents
describe Imap::Backup::Configuration::ConnectionTester do describe ".test" do let(:connection) do instance_double(Imap::Backup::Account::Connection, client: nil) end before do allow(Imap::Backup::Account::Connection).to receive(:new) { connection } end describe "call" do it "tries to connect" do expect(connection).to receive(:client) subject.test("foo") end end describe "success" do it "returns success" do expect(subject.test("foo")).to match(/successful/) end end describe "failure" do before do allow(connection).to receive(:client).and_raise(error) end context "with no connection" do let(:error) do data = OpenStruct.new(text: "bar") response = OpenStruct.new(data: data) Net::IMAP::NoResponseError.new(response) end it "returns error" do expect(subject.test("foo")).to match(/no response/i) end end context "when caused by other errors" do let(:error) { "Error" } it "returns error" do expect(subject.test("foo")).to match(/unexpected error/i) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems