diff --git a/Procfile b/Procfile index 4ffee1c6..3d3c4a4c 100644 --- a/Procfile +++ b/Procfile @@ -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 diff --git a/app/assets/javascripts/user/app/app.js.coffee b/app/assets/javascripts/user/app/app.js.coffee index 21ff0768..a6998e6a 100644 --- a/app/assets/javascripts/user/app/app.js.coffee +++ b/app/assets/javascripts/user/app/app.js.coffee @@ -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' diff --git a/app/views/dashboard/close_window.html.erb b/app/views/dashboard/close_window.html.erb index 4536e3af..fce10b0e 100644 --- a/app/views/dashboard/close_window.html.erb +++ b/app/views/dashboard/close_window.html.erb @@ -1,7 +1,17 @@ - + diff --git a/spec/acceptance/users/active_list.feature b/spec/acceptance/users/active_list.feature index 0e38edff..10eddc36 100644 --- a/spec/acceptance/users/active_list.feature +++ b/spec/acceptance/users/active_list.feature @@ -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 diff --git a/spec/acceptance/users/changing_table.feature b/spec/acceptance/users/changing_table.feature index 8c73becb..5fe2062a 100644 --- a/spec/acceptance/users/changing_table.feature +++ b/spec/acceptance/users/changing_table.feature @@ -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 diff --git a/spec/acceptance/users/get_product_information.feature b/spec/acceptance/users/get_product_information.feature index 1980ffcf..d29e972e 100644 --- a/spec/acceptance/users/get_product_information.feature +++ b/spec/acceptance/users/get_product_information.feature @@ -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 diff --git a/spec/acceptance/users/join_an_occupied_table.feature b/spec/acceptance/users/join_an_occupied_table.feature index adaa0baf..7d858ad2 100644 --- a/spec/acceptance/users/join_an_occupied_table.feature +++ b/spec/acceptance/users/join_an_occupied_table.feature @@ -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 diff --git a/spec/acceptance/users/order_a_product.feature b/spec/acceptance/users/order_a_product.feature index 7bd15f47..fd576f5e 100644 --- a/spec/acceptance/users/order_a_product.feature +++ b/spec/acceptance/users/order_a_product.feature @@ -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 diff --git a/spec/acceptance/users/sign_up_with_facebook.feature b/spec/acceptance/users/sign_up_with_facebook.feature index 3d3f9ea2..17f6fb82 100644 --- a/spec/acceptance/users/sign_up_with_facebook.feature +++ b/spec/acceptance/users/sign_up_with_facebook.feature @@ -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 diff --git a/spec/acceptance_steps/global_list_steps.rb b/spec/acceptance_steps/global_list_steps.rb index ed80c744..455b71dd 100644 --- a/spec/acceptance_steps/global_list_steps.rb +++ b/spec/acceptance_steps/global_list_steps.rb @@ -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 diff --git a/spec/acceptance_steps/supplier_steps.rb b/spec/acceptance_steps/supplier_steps.rb index fc55e333..cb05bdbb 100644 --- a/spec/acceptance_steps/supplier_steps.rb +++ b/spec/acceptance_steps/supplier_steps.rb @@ -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 diff --git a/spec/acceptance_steps/users/authentication_steps.rb b/spec/acceptance_steps/users/authentication_steps.rb index 4d93bd50..8ad9416c 100644 --- a/spec/acceptance_steps/users/authentication_steps.rb +++ b/spec/acceptance_steps/users/authentication_steps.rb @@ -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 diff --git a/wip.md b/wip.md index 8a9d5229..ae8acaf9 100644 --- a/wip.md +++ b/wip.md @@ -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