features/printing_hash.feature in table_print-1.1.1 vs features/printing_hash.feature in table_print-1.1.2
- old
+ new
@@ -4,14 +4,48 @@
Given a variable named data with
|title | author |
|First post! | Ryan |
|Second post! | John |
|Third post! | Peter |
- And table_print data
+ When I table_print data
Then the output should contain
"""
TITLE | AUTHOR
---------------------
First post! | Ryan
Second post! | John
Third post! | Peter
- """
\ No newline at end of file
+ """
+
+ Scenario: A lambda column
+ Given a variable named data with
+ |title | author |
+ |First post! | Ryan |
+ |Second post! | John |
+ |Third post! | Peter |
+ When I table_print data, [:include => {:two => lambda{|hash| hash[:author]*2}}]
+ Then the output should contain
+ """
+ TITLE | AUTHOR | TWO
+ ----------------------------------
+ First post! | Ryan | RyanRyan
+ Second post! | John | JohnJohn
+ Third post! | Peter | PeterPeter
+ """
+
+ Scenario: A method on the object
+ Given a variable named data with
+ |title | author |
+ |First post! | Ryan |
+ |Second post! | John |
+ |Third post! | Peter |
+ When I table_print data, [:include => :size]
+ Then the output should contain
+ """
+ TITLE | AUTHOR | SIZE
+ ----------------------------
+ First post! | Ryan | 2
+ Second post! | John | 2
+ Third post! | Peter | 2
+ """
+
+