Check if set is redefining a param at the class level. Fixes #939

This commit is contained in:
Thomas Reynolds 2013-06-17 00:47:10 +00:00
parent f0707c0968
commit efe52f7cca
3 changed files with 26 additions and 1 deletions

View file

@ -0,0 +1,20 @@
Feature: v3 Modular Extension
Scenario: Registering and overwriting a system config option
Given a fixture app "large-build-app"
And a file named "config.rb" with:
"""
module MyFeature
class << self
def registered(app)
app.set :css_dir, "lib/my/css"
end
alias :included :registered
end
end
::Middleman::Extensions.register(:my_feature, MyFeature)
activate :my_feature
"""
Given a successfully built app at "large-build-app"
When I cd to "build"
Then the file "link_test.html" should contain "lib/my/css/test.css"

View file

@ -0,0 +1,5 @@
---
layout: false
---
<%= stylesheet_link_tag :test %>

View file

@ -22,7 +22,7 @@ module Middleman
# @param default Attribute value # @param default Attribute value
# @return [void] # @return [void]
def set(key, default=nil, &block) def set(key, default=nil, &block)
config.define_setting(key, default) config.define_setting(key, default) unless config.defines_setting?(key)
@inst.set(key, default, &block) if @inst @inst.set(key, default, &block) if @inst
end end