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
+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