Make all spec work, switch to thoughtbot way of integration testing

This commit is contained in:
2013-04-10 17:06:47 +02:00
parent 7b71e677c9
commit 20fa6ac805
12 changed files with 175 additions and 220 deletions
@@ -1,21 +0,0 @@
require 'acceptance/acceptance_helper'
feature 'Supplier product categories spec', %q{
In order to manage product categories
As a confirmed supplier
I want to have control over product categories and associated products
} do
background do
create_confirmed_supplier 'supplier@qwaiter.com'
end
context "GET #index" do
background do
@product_category = create :product_category, supplier: @supplier
end
scenario "I can see a drag handle having class .handle for sorting the product categories" do
login_supplier_as 'supplier@qwaiter.com'
visit '/supplier/product_categories'
page.should have_selector '.handle'
end
end
end
@@ -1,48 +0,0 @@
require 'acceptance/acceptance_helper'
feature 'Supplier main board spec.rb', %q{
In order to manage active lists and orders
As a confirmed supplier
I want to have control over lists and orders from the main activity panel
} do
background do
CouchPotato.couchrest_database.recreate!
create_confirmed_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 "having javascript activated", 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 'an 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 'an 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}
sleep 0.1
page.should have_selector ".of-list-#{@list.id}"
end
end
end