@@ -305,7 +305,7 @@ module Agents |
||
| 305 | 305 |
host, port, ssl, username = options.values_at(:host, :port, :ssl, :username) |
| 306 | 306 |
|
| 307 | 307 |
log "Connecting to #{host}#{':%d' % port if port}#{' via SSL' if ssl}"
|
| 308 |
- Client.open(host, port, ssl) { |imap|
|
|
| 308 |
+ Client.open(host, Integer(port), ssl) { |imap|
|
|
| 309 | 309 |
log "Logging in as #{username}"
|
| 310 | 310 |
imap.login(username, options[:password]) |
| 311 | 311 |
|
@@ -90,11 +90,23 @@ describe Agents::ImapFolderAgent do |
||
| 90 | 90 |
end |
| 91 | 91 |
|
| 92 | 92 |
it 'should validate the integer fields' do |
| 93 |
+ @checker.options['expected_update_period_in_days'] = 'nonsense' |
|
| 94 |
+ @checker.should_not be_valid |
|
| 95 |
+ |
|
| 93 | 96 |
@checker.options['expected_update_period_in_days'] = '2' |
| 94 | 97 |
@checker.should be_valid |
| 95 | 98 |
|
| 96 |
- @checker.options['expected_update_period_in_days'] = 'nonsense' |
|
| 99 |
+ @checker.options['port'] = -1 |
|
| 100 |
+ @checker.should_not be_valid |
|
| 101 |
+ |
|
| 102 |
+ @checker.options['port'] = 'imap' |
|
| 97 | 103 |
@checker.should_not be_valid |
| 104 |
+ |
|
| 105 |
+ @checker.options['port'] = '143' |
|
| 106 |
+ @checker.should be_valid |
|
| 107 |
+ |
|
| 108 |
+ @checker.options['port'] = 993 |
|
| 109 |
+ @checker.should be_valid |
|
| 98 | 110 |
end |
| 99 | 111 |
|
| 100 | 112 |
it 'should validate the boolean fields' do |