Green specs 😄

This commit is contained in:
2014-10-02 13:10:25 +02:00
parent faaa06f0dc
commit 7c03b4c32c
13 changed files with 46 additions and 25 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
#web: bundle exec thin start -p $PORT
faye: thin start -R faye/config.ru -p 9296
faye: thin start -R faye/config.ru -p 9296 --pid tmp/pids/faye.pid
# production: faye: thin start -d -R faye/config.ru -p 9296
counters: bin/drb_counter.rb run
counters: bin/drb_counter.rb run -- development
# production: conters: bin/drb_counter.rb start
#database: echo "BuenosAires" | sudo -S couchdb start | ~/bin/couch_output
#server: rails s
@@ -13,14 +13,17 @@
obtain_token: (message)->
message ||= ''
auth_win = window.open $obtain_token_url, "_blank", "location=no"
auth_win.addEventListener "loadstart", (event)->
auth_win.addEventListener "loadstart", (event)=>
if event.url.match 'close_window'
user_id = event.url.match(/user_id=([\w+-]+)/)[1]
auth_token = event.url.match(/authentication_token=([\w-]+)/)[1]
Qstorage.setItem 'user_id', user_id
Qstorage.setItem 'auth_token', auth_token
@handleAuthInfo(user_id, auth_token)
auth_win.close()
true
handleAuthInfo: (user_id, auth_token)->
Qstorage.setItem 'user_id', user_id
Qstorage.setItem 'auth_token', auth_token
@__container__.lookup('controller:application').setCurrentList()
App.deferReadiness()
Ember.$.ajaxPrefilter (options) ->
if options.type.toUpperCase() == 'GET'
+11 -1
View File
@@ -1,7 +1,17 @@
<!doctype html>
<html>
<head>
<script>localStorage.setItem('auth_token', '<%= params[:authentication_token] %>'); localStorage.setItem('user_id', '<%= params[:user_id] %>');window.close()</script>
<script>
if(window.parent && window.opener.App && window.opener.App.handleAuthInfo){
window.opener.App.handleAuthInfo('<%= params[:user_id] %>', '<%= params[:authentication_token] %>');
window.close();
}else{
localStorage.setItem('auth_token', '<%= params[:authentication_token] %>');
localStorage.setItem('user_id', '<%= params[:user_id] %>');
window.close();
setTimeout(function(){alert('Something went wrong. Please restart the application and warnd the Mozo crew it the proplem persists')}, 5000);
}
</script>
</head>
<body></body>
</html>
+4 -4
View File
@@ -2,7 +2,7 @@ Feature: Active list view
@javascript
Scenario: Loading lists and switching back to the active list works, lists loading may unlink active list orders
Given There is an open supplier with a menu
Given there is an open supplier with a menu
And there is a signed in user with an active order
And the user is on the active list page
When the user opens the side menu
@@ -13,7 +13,7 @@ Feature: Active list view
@javascript
Scenario: Order disappears and counter adjusts when a placed order is cancelled
Given There is an open supplier with a menu
Given there is an open supplier with a menu
And there is a signed in user with a placed order
And the user is on the active list page
And the supplier orders placed counter for the user should be 1
@@ -24,7 +24,7 @@ Feature: Active list view
@javascript
Scenario: Order disappears and counter adjusts when an active order is cancelled
Given There is an open supplier with a menu
Given there is an open supplier with a menu
And there is a signed in user with an active order
And the user is on the active list page
And the supplier orders in process counter for the user should be 1
@@ -35,7 +35,7 @@ Feature: Active list view
@javascript
Scenario: Two users on the same list when one place an order
Given There is an open supplier with a menu
Given there is an open supplier with a menu
And there is a signed in user with an active order
And the user is on the active list page
And there is another signed in user on the same list
+2 -2
View File
@@ -2,7 +2,7 @@ Feature: Changing table
@javascript
Scenario: Scanning a table not yet occupied and change to it
Given There is an open supplier with a menu
Given there is an open supplier with a menu
And there is a signed in user with an active order
And the user is on the homepage
And there is another table
@@ -15,7 +15,7 @@ Feature: Changing table
@javascript
Scenario: Scanning a table already occupied
Given There is an open supplier with a menu
Given there is an open supplier with a menu
And there is a signed in user with an active order
And the user is on the homepage
And there is another table with an active list of another user
@@ -2,7 +2,7 @@ Feature: Getting product information during an order
@javascript
Scenario: Happy flow
Given There is an open supplier with a menu
Given there is an open supplier with a menu
And the product 'Heineken beer' has description 'Brewed in Amsterdam'
And I am signed in as a user
And I am on the user homepage
@@ -2,7 +2,7 @@ Feature: Joining an occupied table
@javascript
Scenario: Happy flow
Given There is an open supplier with a menu
Given there is an open supplier with a menu
And there is a signed in user with an active order
And I am on the user homepage
When another user scans the QR code on the table
@@ -16,7 +16,7 @@ Feature: Joining an occupied table
@javascript
Scenario: Original user rejects the join request
Given There is an open supplier with a menu
Given there is an open supplier with a menu
And there is a signed in user with an active order
And I am on the user homepage
When another user scans the QR code on the table
@@ -2,7 +2,7 @@ Feature: Ordering a product as a user
@javascript
Scenario: Happy flow
Given There is an open supplier with a menu
Given there is an open supplier with a menu
And I am signed in as a user
And I am on the user homepage
When the user scans a table QR code
@@ -27,7 +27,7 @@ Feature: Ordering a product as a user
@javascript
Scenario: Resetting an active order
Given There is an open supplier with a menu
Given there is an open supplier with a menu
And I am signed in as a user
And I am on the user homepage
When the user scans a table QR code
@@ -43,7 +43,7 @@ Feature: Ordering a product as a user
@javascript
Scenario: Loading lists and switching to the order products view works, lists loading may unlink active list orders
Given There is an open supplier with a menu
Given there is an open supplier with a menu
And there is a signed in user with an active order
And the user has an older list for the same supplier
And I wait 1 second
@@ -28,13 +28,14 @@ Feature: Sign up as user using facebook
And I wait 4 seconds
Then the newly created user info should be stored in the local storage
@javascipt
@javascript
Scenario: Authenciation when there is a list already active
Given there is a confirmed and open supplier
And there is a user
And there is a facebook user
And the user has an active order
When the user authenticates with facebook
Then the user should be redirected to the active list page
When I visit the user obtain token path
And I wait 1 second
Then the user should be redirected to the user order overview page
Scenario: Facebook problem OmniAuth.config.mock_auth[:facebook] = :invalid_credentials
Scenario: Valid facebook login, but declines information requested by scope
+1 -1
View File
@@ -10,7 +10,7 @@ end
step "the user has an active list with a/an :order_status order" do |order_status|
@list = create :list, supplier: @supplier, table: @table, user_ids: [@user.id]
@product ||= create :product, supplier: @supplier, name: 'Beer', price: 2.34
@order = create :order, order_status.to_sym, supplier: @supplier, list: @list
@order = create :order, order_status.to_sym, supplier: @supplier, list: @list, user: @user
@product_order = create :product_order, order: @order, product: @product, quantity: 2, price: 2.34
@user.reload
@user.active_list_id = @list.id
+1 -1
View File
@@ -1,4 +1,4 @@
step "There is an open supplier with a menu" do
step "there is an open supplier with a menu" do
step 'there is a confirmed and open supplier'
@apple_pie= create :product, name: 'Apple pie', supplier: @supplier, price: 4.28
@heineken_beer = create :product, name: 'Heineken beer', supplier: @supplier, price: 2.34
@@ -14,8 +14,14 @@ step "there is a user" do
@user ||= create :user
end
step "there is a facebook user" do
if @user
raise "There already is a user, but not a facebook user"
else
@user ||= create :user, provider: 'facebook', uid: '123456790' # uid from spec_helper oauth setup
end
end
step "I am signed in as a user" do
step "there is a confirmed and open supplier"
step "there is a user"
visit test_login_admin_users_path(email: @user.email)
end
+1
View File
@@ -4,6 +4,7 @@ Release
Supplier
--------
- SETTINGS SUBMIT EXPRESSIVE!!!!!!
- english emails
- form action button looks (Roos)
- Add qr print functionality offering to send the stickers