Spec squashing

This commit is contained in:
2015-09-21 18:25:37 +02:00
parent 61dba311fa
commit ee199d7da8
18 changed files with 82 additions and 73 deletions
@@ -12,6 +12,8 @@ Feature: Manage employees
And I click on selector '.modal-confirm'
And I wait 1 second
Then the new employee should be added to the supplier
When I reload the page
Then the supplier employee should see content 'new-employee@example.com'
@javascript
Scenario: adding an already existing employee that was firstly added as manager without manager and active
@@ -8,6 +8,10 @@ step "the supplier employee clicks on the other employee table edit button" do
all('tr').last.find('.table-edit').click
end
step "the supplier employee should see content :content" do |content|
page.should have_content content
end
step "the supplier employee clicks on the existing employee table destroy button" do
find 'table.table'
sleep 0.2
@@ -70,7 +70,7 @@ step "the section table should not have any active list markings anymore" do
css_class.should_not include 'occupied'
css_class.should_not include 'active_order'
css_class.should_not include 'needs_payment'
ember_find('table', @table.id)['active_list_id'].should_not be_present
ember_find('table', @table.id)['active_list'].should_not be_present
end
step "I should be redirected to the supplier section view" do
+3 -5
View File
@@ -1,7 +1,7 @@
module SpecEmberHelpers
def ember_store
h = page.evaluate_script <<-SCRIPT
$s = (MozoUser || App).__container__.lookup('store:main');
$s = (window.MozoUser || App).__container__.lookup('store:main');
JSON.stringify({
lists: $s.all('list').invoke('serialize'),
orders: $s.all('order').invoke('serialize'),
@@ -84,14 +84,12 @@ module SpecEmberHelpers
end
def ember_find(typeKey, id)
h = page.evaluate_script <<-SCRIPT
(MozoUser || App).__container__.lookup('service:store').peekRecord('#{typeKey}', '#{id}').toJSON()
SCRIPT
h = page.evaluate_script "(window.MozoUser || App).__container__.lookup('service:store').peekRecord('#{typeKey}', '#{id}').toJSON()"
end
def ember_all(typeKey)
h = page.evaluate_script <<-SCRIPT
(MozoUser || App).__container__.lookup('service:store').peekAll('#{typeKey}').map(function(r){ result = r.toJSON(); result['id'] = r.id; return result })
(window.MozoUser || App).__container__.lookup('service:store').peekAll('#{typeKey}').map(function(r){ result = r.toJSON(); result['id'] = r.id; return result })
SCRIPT
end
+1 -1
View File
@@ -31,7 +31,7 @@ module SpecRouteHelpers
# currentRouteName does not include model information: /list/123 => currentRouteName == 'list'
# page.evaluate_script %|App.__container__.lookup('controller:application').get('currentRouteName')|
# page.evaluate_script %|App.__container__.lookup('router:main').location.lastSetURL| # not working for direct path supplier#/settings
route = page.evaluate_script(%{(MozoUser || App).__container__ && (window.location.hash || "#/").substr(1)})
route = page.evaluate_script(%{(window.MozoUser || App).__container__ && (window.location.hash || "#/").substr(1)})
unless omit_should_raise
def route.should(*)
raise "Cannot call should on ember route. Use ember_route_should_be instead"