26 lines
813 B
Ruby
26 lines
813 B
Ruby
module SpecEmberHelpers
|
|
def ember_store
|
|
h = page.evaluate_script <<-SCRIPT
|
|
$s = App.__container__.lookup('controller:application').store;
|
|
JSON.stringify({
|
|
lists: $s.all('list').invoke('serialize'),
|
|
orders: $s.all('order').invoke('serialize'),
|
|
product_orders: $s.all('product_order').invoke('serialize'),
|
|
product_categories: $s.all('product_category').invoke('serialize'),
|
|
products: $s.all('product').invoke('serialize'),
|
|
sections: $s.all('section').invoke('serialize'),
|
|
tables: $s.all('table').invoke('serialize')
|
|
})
|
|
SCRIPT
|
|
JSON.parse(h)
|
|
end
|
|
|
|
def js_path
|
|
page.evaluate_script 'location.pathname + location.hash'
|
|
end
|
|
|
|
def faye_log
|
|
JSON.parse(page.evaluate_script(%|JSON.stringify(window.faye_log)|))
|
|
end
|
|
end
|