Skip to content

Commit

Permalink
fix #37 so that default values are carried through to multiple attrib…
Browse files Browse the repository at this point in the history
…utes defined on the same line
  • Loading branch information
AaronLasseigne committed Aug 6, 2013
1 parent 4a37864 commit 2232476
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/active_interaction/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def self.method_missing(type, *args, &block)

# @private
def self.set_up_reader(attribute, filter, options, &block)
options = options.dup

default = nil
if options.has_key?(:default)
begin
Expand Down
5 changes: 5 additions & 0 deletions spec/support/interactions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
send(type, :default, filter_options.merge(default: generator.call))
send(type, :nil_default,
filter_options.merge(allow_nil: true, default: nil))
send(type, :multi_default_1, :multi_default_2, filter_options.merge(default: generator.call))

def execute
{
Expand Down Expand Up @@ -75,6 +76,10 @@ def execute
it 'returns the correct value for :default' do
expect(result[:default]).to eq default
end

it 'sets the default on multiple attributes' do
expect(outcome).to be_valid
end
end
end
end

0 comments on commit 2232476

Please sign in to comment.