Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.71 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. When /^I request the "([^"]*)" endpoint using credentials "([^"]*)":"([^"]*)"$/ do |endpoint, email, pwd|
  2.   visit_authenticated_endpoint(endpoint, {:user => email, :password => pwd})
  3. end
  4.  
  5. When /^I request the "([^"]*)" endpoint$/ do |endpoint, email, pwd|
  6.   visit_endpoint(endpoint)
  7. end
  8.  
  9.  
  10. Then /^I should receive a json list like:$/ do |table|
  11.   compare_json_list_to_table(from_json(@response), table)
  12. end
  13.  
  14. Then /^I should receive a json hash like:$/ do |table|
  15.   compare_json_hash_to_table_row_hash(from_json(@response), table.hashes.first)
  16. end
  17.  
  18. Given /^the existing ([a-zA-Z0-9]+s):$/ do |klasses, table|
  19.   klass = klasses.singularize.camelize.constantize
  20.   table.hashes.each do |row|
  21.     klass.make(row) #uses machinist
  22.   end
  23. end