fix bug for closing lists on preloaded view and add acceptance body

This commit is contained in:
2012-12-01 13:20:39 +01:00
parent 2a09e2022d
commit a14687d568
9 changed files with 72 additions and 9 deletions
+1
View File
@@ -0,0 +1 @@
--color
+1 -4
View File
@@ -52,12 +52,9 @@ group :development do
end end
group :test do group :test do
gem 'rspec-rails' gem 'steak'
#gem 'minitest'
gem 'pry' gem 'pry'
gem 'factory_girl_rails' gem 'factory_girl_rails'
gem 'selenium-webdriver' #, '2.21.1' # 2.21.2 gives trouble, remove this line when this is solved since this is a dependency of capybara
gem 'capybara'
end end
# Use unicorn as the app server # Use unicorn as the app server
+7 -3
View File
@@ -46,6 +46,7 @@ GEM
activesupport (3.2.9) activesupport (3.2.9)
i18n (~> 0.6) i18n (~> 0.6)
multi_json (~> 1.0) multi_json (~> 1.0)
addressable (2.3.2)
arel (3.0.2) arel (3.0.2)
bcrypt-ruby (3.0.1) bcrypt-ruby (3.0.1)
builder (3.0.4) builder (3.0.4)
@@ -123,7 +124,8 @@ GEM
actionpack (>= 3.1) actionpack (>= 3.1)
less (~> 2.2.0) less (~> 2.2.0)
libv8 (3.3.10.4) libv8 (3.3.10.4)
libwebsocket (0.1.6.1) libwebsocket (0.1.7.1)
addressable
websocket websocket
mail (2.4.4) mail (2.4.4)
i18n (>= 0.4.0) i18n (>= 0.4.0)
@@ -211,6 +213,9 @@ GEM
multi_json (~> 1.0) multi_json (~> 1.0)
rack (~> 1.0) rack (~> 1.0)
tilt (~> 1.1, != 1.3.0) tilt (~> 1.1, != 1.3.0)
steak (2.0.0)
capybara (>= 1.0.0)
rspec-rails (>= 2.5.0)
subexec (0.2.2) subexec (0.2.2)
temple (0.5.5) temple (0.5.5)
therubyracer (0.10.2) therubyracer (0.10.2)
@@ -242,7 +247,6 @@ PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
capybara
coffee-rails (~> 3.2.1) coffee-rails (~> 3.2.1)
compass-rails compass-rails
couch_potato! couch_potato!
@@ -262,9 +266,9 @@ DEPENDENCIES
rqrcode rqrcode
rspec-rails rspec-rails
sass-rails (~> 3.2.3) sass-rails (~> 3.2.3)
selenium-webdriver
simply_stored! simply_stored!
slim-rails slim-rails
steak
therubyracer therubyracer
thin thin
twitter-bootstrap-rails twitter-bootstrap-rails
+1
View File
@@ -51,6 +51,7 @@ class SupplierController < ApplicationController
ho[:table_number] = order.table_number ho[:table_number] = order.table_number
ho[:section_title] = order.list.table.section.try(:title) ho[:section_title] = order.list.table.section.try(:title)
ho[:id] = order.id ho[:id] = order.id
ho[:list_id] = order.list_id
list_total += ho[:total_amount] list_total += ho[:total_amount]
h[:orders] << ho h[:orders] << ho
end end
+2 -2
View File
@@ -25,7 +25,7 @@ html lang="en"
- unless ENV['QWAITER_MOBILE_EXPORT'] == 'yes' - unless ENV['QWAITER_MOBILE_EXPORT'] == 'yes'
javascript: javascript:
#{Rails.env.production? ? '' : "data_host = 'http://qwaiter.dev';"} #{Rails.env.production? ? '' : "data_host = 'http://qwaiter.dev';"}
//var data_host = 'http://localhost:3000'; var data_host = 'http://localhost:3000';
QMobile || (QMobile = { QMobile || (QMobile = {
scanQr: function(){window.location = '/select_qrcode'}, scanQr: function(){window.location = '/select_qrcode'},
activateRotation: function(){}, activateRotation: function(){},
@@ -76,7 +76,7 @@ html lang="en"
.span12 .span12
= yield = yield
= javascript_include_tag "user/application" = javascript_include_tag "user/application"
script#alert-template[type="text/html"]= render 'alert.mustache' script#alert-template[type="text/html"]= render 'user/alert.mustache'
= yield :footer = yield :footer
javascript: javascript:
jQuery(function(){#{onload_javascript}}); jQuery(function(){#{onload_javascript}});
+4
View File
@@ -0,0 +1,4 @@
require 'spec_helper'
# Put your acceptance spec helpers inside spec/acceptance/support
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
@@ -0,0 +1,17 @@
require 'acceptance/acceptance_helper'
feature 'Supplier main board spec.rb', %q{
In order to manage active orders
As a supplier
I want to have control
} do
background do
create_supplier 'supplier@qwaiter.com'
create_user 'user@qwaiter.com'
end
scenario 'loaded orders should have a list_id present for handling actions' do
login_supplier_as 'supplier@qwaiter.com'
end
end
+30
View File
@@ -0,0 +1,30 @@
module HelperMethods
# Put helper methods you need to be available in all acceptance specs here.
def create_user(email, password='secret')
@user = User.find_by_email(email) || FactoryGirl.create(:user, email: email, password: password)
end
def create_supplier(email, password='secret')
@supplier = Supplier.find_by_email(email) || FactoryGirl.create(:supplier, email: email, password: password)
end
def login_user_as(email)
visit "/users/sign_in"
fill_in "user_email", with: email
fill_in "user_password", with: "secret"
submit_form
end
def login_supplier_as(email)
visit "/suppliers/sign_in"
fill_in "supplier_email", with: email
fill_in "supplier_password", with: "secret"
submit_form
end
def submit_form
find("[type=submit]").click
end
end
RSpec.configuration.include HelperMethods, :type => :acceptance
+9
View File
@@ -0,0 +1,9 @@
module NavigationHelpers
# Put helper methods related to the paths in your application here.
def homepage
"/"
end
end
RSpec.configuration.include NavigationHelpers, :type => :acceptance