spec/unit/configuration/account_spec.rb in imap-backup-1.3.0 vs spec/unit/configuration/account_spec.rb in imap-backup-1.4.0
- old
+ new
@@ -33,11 +33,13 @@
end
context "#run" do
let(:highline) { double("Highline") }
let(:menu) { MockHighlineMenu.new }
- let(:store) { double("Imap::Backup::Configuration::Store", accounts: accounts) }
+ let(:store) do
+ double("Imap::Backup::Configuration::Store", accounts: accounts)
+ end
let(:accounts) { [account, account1] }
let(:account) do
{
username: existing_email,
server: existing_server,
@@ -130,11 +132,12 @@
end
end
context "email" do
before do
- allow(Imap::Backup::Configuration::Asker).to receive(:email).and_return(new_email)
+ allow(Imap::Backup::Configuration::Asker).
+ to receive(:email) { new_email }
subject.run
menu.choices["modify email"].call
end
context "if the server is blank" do
@@ -174,11 +177,12 @@
context "the email already exists" do
let(:new_email) { other_email }
it "indicates the error" do
- expect(subject).to have_received(:puts).with("There is already an account set up with that email address")
+ expect(subject).to have_received(:puts).
+ with("There is already an account set up with that email address")
end
it "doesn't set the email" do
expect(account[:username]).to eq(existing_email)
end
@@ -189,11 +193,12 @@
context "password" do
let(:new_password) { "new_password" }
before do
- allow(Imap::Backup::Configuration::Asker).to receive(:password).and_return(new_password)
+ allow(Imap::Backup::Configuration::Asker).
+ to receive(:password) { new_password }
subject.run
menu.choices["modify password"].call
end
context "if the user enters a password" do
@@ -237,11 +242,13 @@
context "backup_path" do
let(:new_backup_path) { "/new/path" }
before do
@validator = nil
- allow(Imap::Backup::Configuration::Asker).to receive(:backup_path) do |path, validator|
+ allow(
+ Imap::Backup::Configuration::Asker
+ ).to receive(:backup_path) do |path, validator|
@validator = validator
new_backup_path
end
subject.run
menu.choices["modify backup path"].call
@@ -260,11 +267,12 @@
context "folders" do
let(:chooser) { double(run: nil) }
before do
- allow(Imap::Backup::Configuration::FolderChooser).to receive(:new).and_return(chooser)
+ allow(Imap::Backup::Configuration::FolderChooser).
+ to receive(:new) { chooser }
subject.run
menu.choices["choose backup folders"].call
end
it "edits folders" do
@@ -272,17 +280,19 @@
end
end
context "connection test" do
before do
- allow(Imap::Backup::Configuration::ConnectionTester).to receive(:test).and_return("All fine")
+ allow(Imap::Backup::Configuration::ConnectionTester).
+ to receive(:test).and_return("All fine")
allow(highline).to receive(:ask)
subject.run
menu.choices["test connection"].call
end
it "tests the connection" do
- expect(Imap::Backup::Configuration::ConnectionTester).to have_received(:test).with(account)
+ expect(Imap::Backup::Configuration::ConnectionTester).
+ to have_received(:test).with(account)
end
end
context "deletion" do
let(:confirmed) { true }