1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
Feature: Printing structs
Scenario: A simple array of structs
Given an array of structs named data with
|title | author |
|First post! | Ryan |
|Second post! | John |
|Third post! | Peter |
When I table_print data
Then the output should contain
"""
TITLE | AUTHOR
-------------|-------
First post! | Ryan
Second post! | John
Third post! | Peter
"""
Scenario: A lambda column
Given an array of structs 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 an array of structs 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
"""
|