Commit 62620654 authored by Antonio Terceiro's avatar Antonio Terceiro

Debci::Config: don't break config values containing "="

parent 8a1cb558
......@@ -55,7 +55,7 @@ module Debci
if pair
pair[1]
else
lambda { |x| x }
lambda { |x| x == "" ? nil : x }
end
end
......@@ -63,7 +63,7 @@ module Debci
# :nodoc:
IO.popen(['debci', 'config', *members.map(&:to_s)]) do |data|
data.each_line.each do |line|
key, value = line.strip.split('=')
key, value = line.strip.split('=', 2)
cast = self.class.cast_for(key)
value = cast.call(value)
self.send("#{key}=", value)
......
......@@ -36,4 +36,10 @@ describe Debci::Config do
expect(config.data_basedir).to eq('/path/to/data')
end
it 'splits at the first equal sign only' do
url = "sqlite3:/path/to/db.sqlite3?timeout=5000"
@io.reopen("database_url=#{url}\n")
expect(config.database_url).to eq(url)
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment