changing table user acceptance specs in the green
This commit is contained in:
@@ -14,8 +14,9 @@ step "the uses indicates in the popup that he wants to change the table" do
|
||||
end
|
||||
|
||||
step "the user should see the supplier menu having the other table as base" do
|
||||
route_should_be 'user#list_products'
|
||||
find('.table-number').text.should == @other_table.number.to_s
|
||||
#route_should_be 'user#list_products'
|
||||
page.should have_content 'Apple pie'
|
||||
find('.table-number').text.should == "Tafel #{@other_table.number.to_s}"
|
||||
end
|
||||
|
||||
step "the user list should have been moved to the other table" do
|
||||
@@ -32,7 +33,12 @@ step "there is another table with an active list of another user" do
|
||||
end
|
||||
|
||||
step "the user scans a QR code of another not occupied table" do
|
||||
page.execute_script "Quser.actions_for_table({table_id: '#{@other_table.id}'})"
|
||||
r = page.evaluate_script %|
|
||||
c = App.__container__.lookup('controller:select_qrcode');
|
||||
c.send('selectQr', {_id: "#{@other_table.id}"});
|
||||
c.toString()
|
||||
|
|
||||
#page.execute_script "Quser.actions_for_table({table_id: '#{@other_table.id}'})"
|
||||
end
|
||||
|
||||
step "the user scans a QR code of another occupied table" do
|
||||
|
||||
@@ -108,6 +108,10 @@ RSpec.configure do |config|
|
||||
Qwaiter::Couchbase.load_design_docs!
|
||||
# NOT THREADSAFE!!!!!! but good enough for testing since the real couchbase flush is slowwwwww....
|
||||
Qwaiter::Counter.connection = InMemoryQCounter.new
|
||||
# Threadsafe would be using the drb counter
|
||||
# require 'drb'
|
||||
# counter = DRbObject.new nil, 'druby://:9000'
|
||||
# Qwaiter::Counter.connection = counter
|
||||
end
|
||||
|
||||
config.before :each do
|
||||
|
||||
@@ -3,27 +3,39 @@
|
||||
# a clean start and Hash#clear is soooo much faster than
|
||||
# a couchbase bucket flush
|
||||
class InMemoryQCounter
|
||||
STORE = {}
|
||||
attr_reader :store
|
||||
|
||||
def initialize
|
||||
@store = {}
|
||||
end
|
||||
|
||||
def get(key, options = {})
|
||||
STORE[key]
|
||||
store[key]
|
||||
end
|
||||
|
||||
def set(key, value)
|
||||
STORE[key] = value
|
||||
store[key] = value
|
||||
end
|
||||
|
||||
def incr(key, options = {})
|
||||
STORE[key] ||= options[:initial].to_i
|
||||
STORE[key] += 1
|
||||
store[key] ||= options[:initial].to_i
|
||||
store[key] += 1
|
||||
end
|
||||
|
||||
def decr(key, options = {})
|
||||
STORE[key] ||= options[:initial].to_i
|
||||
STORE[key] -= 1
|
||||
store[key] ||= options[:initial].to_i
|
||||
store[key] -= 1
|
||||
end
|
||||
|
||||
def flush
|
||||
STORE.clear
|
||||
store.clear
|
||||
end
|
||||
end
|
||||
|
||||
=begin Make drb server
|
||||
require 'drb'
|
||||
DRb.start_service 'druby://:9000', InMemoryQCounter.new
|
||||
puts "Counter server running at #{DRb.uri}"
|
||||
trap("INT") { DRb.stop_service }
|
||||
DRb.thread.join
|
||||
=end
|
||||
|
||||
Reference in New Issue
Block a user