Permalink
Browse files

Fixes #19: Saved config with :include raises undefined method error

  • Loading branch information...
arches committed Jun 25, 2012
1 parent b9c3603 commit 078f10ada34a719091c1579dad083360fbdf1b91
Showing with 21 additions and 1 deletion.
  1. +14 −0 features/configuring_output.feature
  2. +7 −1 lib/config_resolver.rb
@@ -27,6 +27,20 @@ Feature: Configuring output
-----
post!
"""
+ Scenario: Specifying configuration on a per-object basis with an included column
+ Given a class named Blog
+
+ Given Blog has attributes title, author
+
+ When I instantiate a Blog with {:title => "post!", :author => 'Ryan'}
+ And configure Blog with {:include => {:foobar => lambda{|b| b.title}}}
+ And table_print Blog
+ Then the output should contain
+ """
+ TITLE | AUTHOR | FOOBAR
+ -----------------------
+ post! | Ryan | post!
+ """
Scenario: Applying a formatter
Scenario: Setting a column name
Given a class named Blog
View
@@ -24,7 +24,13 @@ def process_option_set(options)
# process special symbols
@included_columns.concat [get_and_remove(options, :include)].flatten
- @included_columns.map!{|option| option_to_column(option)}
+ @included_columns.map! do |option|
+ if option.is_a? Column
+ option if option.is_a? Column
+ else
+ option_to_column(option)
+ end
+ end
@included_columns.each do |c|
@column_hash[c.name] = c

0 comments on commit 078f10a

Please sign in to comment.