48 lines
1.5 KiB
Ruby
48 lines
1.5 KiB
Ruby
require 'acceptance/acceptance_helper'
|
|
|
|
feature 'Supplier main board spec.rb', %q{
|
|
In order to manage active list and orders
|
|
As a supplier
|
|
I want to have control over list and orders from the main activity panel
|
|
} do
|
|
background do
|
|
CouchPotato.couchrest_database.recreate!
|
|
create_supplier 'supplier@qwaiter.com'
|
|
create_user 'user@qwaiter.com'
|
|
end
|
|
|
|
def create_active_list(options = {})
|
|
@table = create :table, supplier: @supplier
|
|
@list = create :list, supplier: @supplier, table: @table, user_ids: [@user.id]
|
|
end
|
|
|
|
context "using javascript", js: true do
|
|
|
|
scenario 'the active list should be present and contained in row having its id' do
|
|
create_active_list
|
|
login_supplier_as 'supplier@qwaiter.com'
|
|
visit '/supplier'
|
|
page.should have_selector "#list-row-#{@list.id}"
|
|
end
|
|
|
|
scenario 'order is added to the list before visiting the page' do
|
|
create_active_list
|
|
login_supplier_as 'supplier@qwaiter.com'
|
|
product = create :product, supplier: @supplier
|
|
sleep 0.1
|
|
@list.place_order @user, {product.id => 369}
|
|
visit '/supplier'
|
|
page.should have_selector ".of-list-#{@list.id}"
|
|
end
|
|
|
|
scenario 'order is added to the list after visiting the page' do
|
|
create_active_list
|
|
login_supplier_as 'supplier@qwaiter.com'
|
|
product = create :product, supplier: @supplier
|
|
visit '/supplier'
|
|
@list.place_order @user, {product.id => 369}
|
|
page.should have_selector ".of-list-#{@list.id}"
|
|
end
|
|
end
|
|
end
|