Green specs for ember 1.13
This commit is contained in:
@@ -30,7 +30,7 @@ group :assets do
|
||||
#gem 'capistrano-local-precompile', require: false
|
||||
|
||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||
#gem 'therubyracer', platforms: :ruby
|
||||
gem 'therubyracer', platforms: :ruby
|
||||
|
||||
gem 'uglifier', '>= 1.0.3'
|
||||
|
||||
|
||||
+7
-1
@@ -187,7 +187,7 @@ GEM
|
||||
ember-source (>= 1.8.0)
|
||||
jquery-rails (>= 1.0.17)
|
||||
railties (>= 3.1)
|
||||
ember-source (1.13.7)
|
||||
ember-source (1.13.8)
|
||||
ember-validations-rails (1.0.0)
|
||||
railties
|
||||
erubis (2.7.0)
|
||||
@@ -252,6 +252,7 @@ GEM
|
||||
addressable (~> 2.3)
|
||||
letter_opener (1.4.1)
|
||||
launchy (~> 2.2)
|
||||
libv8 (3.16.14.11)
|
||||
loofah (2.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.6.3)
|
||||
@@ -336,6 +337,7 @@ GEM
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rake (10.4.2)
|
||||
ref (2.0.0)
|
||||
responders (2.1.0)
|
||||
railties (>= 4.2.0, < 5)
|
||||
rest-client (1.8.0)
|
||||
@@ -419,6 +421,9 @@ GEM
|
||||
temple (0.7.6)
|
||||
test_squad (0.0.1)
|
||||
rails
|
||||
therubyracer (0.12.2)
|
||||
libv8 (~> 3.16.14.0)
|
||||
ref
|
||||
thor (0.19.1)
|
||||
thread_safe (0.3.5)
|
||||
tilt (1.4.1)
|
||||
@@ -518,6 +523,7 @@ DEPENDENCIES
|
||||
spring-commands-rspec
|
||||
sucker_punch
|
||||
test_squad
|
||||
therubyracer
|
||||
turnip
|
||||
uglifier (>= 1.0.3)
|
||||
web-console (~> 2.0.0)
|
||||
|
||||
@@ -27,6 +27,7 @@ Ember.Application.initializer
|
||||
application.register('global:variables', Globals, {singleton: true})
|
||||
application.inject('controller', 'globals', 'global:variables')
|
||||
application.inject('component', 'globals', 'global:variables')
|
||||
application.inject('route', 'globals', 'global:variables')
|
||||
|
||||
@App = Ember.Application.create
|
||||
LOG_TRANSITIONS: true
|
||||
|
||||
@@ -2,8 +2,10 @@ ControllerExtensions = Ember.Mixin.create
|
||||
needs: ['application']
|
||||
ajaxError: (callback)->
|
||||
handler = (emberError)=>
|
||||
emberError = emberError.errors[0] if emberError.errors and emberError.errors.length
|
||||
console.log "Error: status #{emberError.status}"
|
||||
if emberError.status is 401
|
||||
status = parseInt(emberError.status)
|
||||
if status is 401
|
||||
App.__container__.lookup('route:application').unauthorized()
|
||||
else
|
||||
callback.call(@, emberError)
|
||||
|
||||
@@ -16,6 +16,7 @@ Feature: Sign up as user using facebook
|
||||
Given there is a confirmed and open supplier
|
||||
And there is a facebook user
|
||||
And the user has an active order
|
||||
And there is no user information stored in the local storage
|
||||
#When I visit the user obtain token path
|
||||
When the user is on the homepage
|
||||
Then the user is redirected to the sign in page
|
||||
@@ -38,6 +39,7 @@ Feature: Sign up as user using facebook
|
||||
Given there is a confirmed and open supplier
|
||||
And there is a instagram user
|
||||
And the user has an active order
|
||||
And there is no user information stored in the local storage
|
||||
#When I visit the user obtain token path
|
||||
When the user is on the homepage
|
||||
Then the user is redirected to the sign in page
|
||||
|
||||
@@ -30,8 +30,7 @@ step "the section table should not be marked as in need of help" do
|
||||
end
|
||||
|
||||
step 'the table should be marked as occupied and having an active order' do
|
||||
classes = find(".section-table-#{@table.id}")['class'].split(/\s+/)
|
||||
expect(classes & %w[occupied active_order]).to eq %w[occupied active_order]
|
||||
assert_element_class ".section-table-#{@table.id}", %w[occupied active_order]
|
||||
end
|
||||
|
||||
step "I click on section table as a supplier" do
|
||||
|
||||
@@ -15,16 +15,17 @@ module SpecEmberHelpers
|
||||
JSON.parse(h)
|
||||
end
|
||||
|
||||
def assert_element_class(selector, class_name)
|
||||
def assert_element_class(selector, expected_class_names)
|
||||
find selector # capybara wait for element
|
||||
time = 0
|
||||
classes = page.evaluate_script("$('#{selector}').attr('class')")
|
||||
while !classes.include?(class_name) and time < 10
|
||||
expected_class_names = Array.wrap(expected_class_names).sort
|
||||
found_classes = page.evaluate_script("$('#{selector}').attr('class')").to_s.split(/\s+/).sort
|
||||
while (found_classes & expected_class_names) != expected_class_names and time < 10
|
||||
sleep 0.1
|
||||
classes = page.evaluate_script("$('#{selector}').attr('class')")
|
||||
found_classes = page.evaluate_script("$('#{selector}').attr('class')").to_s.split(/\s+/).sort
|
||||
time += 1
|
||||
end
|
||||
classes.should include class_name
|
||||
(found_classes & expected_class_names).sort.should eq expected_class_names
|
||||
end
|
||||
|
||||
# expect_that_eventually selector: '.supplier-orders-placed-count-number', has_text: "10"
|
||||
|
||||
Reference in New Issue
Block a user