Skip to content

Commit

Permalink
Merge 289aa12 into b3fa45c
Browse files Browse the repository at this point in the history
  • Loading branch information
zzet committed Dec 11, 2013
2 parents b3fa45c + 289aa12 commit 8b0905b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/configus/proxy.rb
Expand Up @@ -15,6 +15,8 @@ def initialize(block)
end

def method_missing(key, value = nil, &block)
raise ArgumentError, "Double definition of key '#{key}'" if @result.keys.include?(key)

@result[key] = block_given? ? self.class.generate(block) : value
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/configus/version.rb
@@ -1,3 +1,3 @@
module Configus
VERSION = "0.0.4"
VERSION = "0.0.5"
end
11 changes: 11 additions & 0 deletions spec/configus/builder_spec.rb
Expand Up @@ -52,4 +52,15 @@
end
expect{ Configus::Builder.new(:production, p) }.to raise_error ArgumentError
end

it 'should raise double definition error' do
p = Proc.new do
env :production do
foo 'bar'
foo 'bom'
end
end

expect{ Configus::Builder.new(:production, p).result }.to raise_error ArgumentError
end
end

0 comments on commit 8b0905b

Please sign in to comment.