data table

(A) *.feature:

And the possiable reservation hours as following:
      | time  |
      | 12:00 |
      | 14:00 |
      | 16:00 |
      | 18:00 |
      | 20:00 |

(A) *steps.rb:

table.hashes.each{|value| puts value["time"]}
=begin
12:00
14:00
16:00
18:00
20:00
=end

(B) *.feature:

When the client requests POST "/reservations" with valid details as following:
      | First name      | F                   |
      | Last name       | L                   |
      | Phone number    | 123                 |
      | Email           | [email protected]  |
      | Guest           | G                   |
      | Reserved time   | 2015/07/10 12:00    |
      | Special request | allergic to peanuts |

(B)*steps.rb:

reservation_info = table.rows_hash
post path,
  first_name: reservation_info["First name"],
  last_name: reservation_info["Last name"],
  phone_number: reservation_info["Phone number"],
  email: reservation_info["Email"],
  reserved_time: reservation_info["Reserved time"],
  special_request: reservation_info["Special request"]

Reference

results matching ""

    No results matching ""