summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Terceiro <terceiro@softwarelivre.org>2014-02-05 17:27:51 -0300
committerAntonio Terceiro <terceiro@softwarelivre.org>2014-02-05 17:27:51 -0300
commit35b6a29db96bbf835c1973f3349856149ecac76f (patch)
tree4182aa39b4126d6bfb6292bbed2831b3664d8fc5
parent6b9107e9f81202ec45446c8f2239e056a5c3e503 (diff)
downloadfeed2imap-35b6a29db96bbf835c1973f3349856149ecac76f.tar.gz
feed2imap-35b6a29db96bbf835c1973f3349856149ecac76f.tar.bz2
feed2imap-35b6a29db96bbf835c1973f3349856149ecac76f.zip
config: fix regression with arrays as target
-rw-r--r--lib/feed2imap/config.rb2
-rwxr-xr-xtest/tc_config.rb16
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/feed2imap/config.rb b/lib/feed2imap/config.rb
index f478296..693d2d6 100644
--- a/lib/feed2imap/config.rb
+++ b/lib/feed2imap/config.rb
@@ -69,7 +69,7 @@ class F2IConfig
maildir_account = MaildirAccount::new
@conf['feeds'].each do |f|
if f['disable'].nil?
- uri = URI::parse(f['target'].to_s)
+ uri = URI::parse(Array(f['target']).join(''))
path = URI::unescape(uri.path)
if uri.scheme == 'maildir'
@feeds.push(ConfigFeed::new(f, maildir_account, path, self))
diff --git a/test/tc_config.rb b/test/tc_config.rb
index ad4877c..255bdb7 100755
--- a/test/tc_config.rb
+++ b/test/tc_config.rb
@@ -45,6 +45,15 @@ feeds:
url: http://something2
target: imap://login:pasword@ezaezae/Feeds/B
EOF
+CONFARRAYTARGET = <<EOF
+parts: text
+include-images: false
+prefix: &target "maildir:///tmp/Maildir/"
+feeds:
+ - name: feed1
+ url: http://something
+ target: [ *target, "feed1" ]
+EOF
class ConfigTest < Test::Unit::TestCase
def test_cache
@@ -79,4 +88,11 @@ class ConfigTest < Test::Unit::TestCase
assert conf.parts.include?('text')
assert ! conf.parts.include?('html')
end
+
+ def test_url_array
+ sio = StringIO::new CONFARRAYTARGET
+ conf = F2IConfig::new(sio)
+ assert_equal "/tmp/Maildir/feed1", conf.feeds.first.folder
+ end
+
end