spec/unit/configuration/asker_spec.rb in imap-backup-0.0.5 vs spec/unit/configuration/asker_spec.rb in imap-backup-1.0.0
- old
+ new
@@ -1,12 +1,10 @@
# encoding: utf-8
-load File.expand_path( '../../spec_helper.rb', File.dirname(__FILE__) )
+require 'spec_helper'
describe Imap::Backup::Configuration::Asker do
-
context '.email' do
-
it 'should ask for an email' do
Imap::Backup::Configuration::Setup.highline.should_receive(:ask).with(/email/)
Imap::Backup::Configuration::Asker.email
end
@@ -27,15 +25,13 @@
it 'should return the address' do
Imap::Backup::Configuration::Setup.highline.stub!(:ask).with(/email/).and_return('new@example.com')
Imap::Backup::Configuration::Asker.email.should == 'new@example.com'
end
-
end
context '.password' do
-
before :each do
Imap::Backup::Configuration::Setup.highline.stub!(:ask).with(/^password/).and_return('secret')
Imap::Backup::Configuration::Setup.highline.stub!(:ask).with(/^repeat password/).and_return('secret')
end
@@ -90,15 +86,13 @@
end
end
Imap::Backup::Configuration::Asker.password.should be_nil
end
-
end
context '.backup_path' do
-
it 'should ask for a directory' do
validator = /validator/
Imap::Backup::Configuration::Setup.highline.should_receive(:ask).with(/directory/) do |&block|
q = stub('HighLine::Question', :responses => {}, :readline= => nil)
q.should_receive(:default=).with('default path')
@@ -113,10 +107,8 @@
it 'should return the choice' do
Imap::Backup::Configuration::Setup.highline.should_receive(:ask).with(/directory/).and_return('/path')
Imap::Backup::Configuration::Asker.backup_path('default path', //).should == '/path'
end
-
end
-
end