mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-05 07:19:14 +00:00
Added distributors request spec.
This commit is contained in:
39
spec/request/distributors_spec.rb
Normal file
39
spec/request/distributors_spec.rb
Normal file
@@ -0,0 +1,39 @@
|
||||
require "spec_helper"
|
||||
|
||||
feature %q{
|
||||
As an administration
|
||||
I want manage the distributors of products
|
||||
} do
|
||||
include AuthenticationWorkflow
|
||||
|
||||
background do
|
||||
end
|
||||
|
||||
context "Given I am setting up distributors" do
|
||||
scenario "I should be able to create a new distributor" do
|
||||
login_to_admin_section
|
||||
|
||||
click_link 'Distributors'
|
||||
click_link 'New Distributor'
|
||||
|
||||
fill_in 'distributor_name', :with => 'Eaterprises'
|
||||
fill_in 'distributor_description', :with => 'Connecting farmers and eaters'
|
||||
fill_in 'distributor_contact', :with => 'Kirsten or Ren'
|
||||
fill_in 'distributor_phone', :with => '0413 897 321'
|
||||
fill_in 'distributor_pickup_address', :with => '35 Ballantyne St'
|
||||
fill_in 'distributor_city', :with => 'Thornbury'
|
||||
fill_in 'distributor_post_code', :with => '3072'
|
||||
select('Australia', :from => 'distributor_country_id')
|
||||
select('Victoria', :from => 'distributor_state_id')
|
||||
fill_in 'distributor_pickup_times', :with => 'Thursday, 22nd Feb, 6 - 9 PM. Friday, 23nd Feb, 6 - 9 PM'
|
||||
fill_in 'distributor_email', :with => 'info@eaterprises.com.au'
|
||||
fill_in 'distributor_url', :with => 'http://eaterprises.com.au'
|
||||
fill_in 'distributor_abn', :with => '09812309823'
|
||||
fill_in 'distributor_acn', :with => ''
|
||||
|
||||
click_button 'Create'
|
||||
|
||||
find('.flash').text.strip.should == 'Distributor "Eaterprises" has been successfully created!'
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -4,28 +4,14 @@ feature %q{
|
||||
As an administration
|
||||
I want manage the suppliers of products
|
||||
} do
|
||||
# include AuthenticationWorkflow
|
||||
# include WebHelper
|
||||
include AuthenticationWorkflow
|
||||
|
||||
background do
|
||||
end
|
||||
|
||||
context "Given I am setting up suppliers" do
|
||||
scenario "I should be able to create a new supplier" do
|
||||
admin_role = Spree::Role.create(:name => 'admin')
|
||||
admin_user = Spree::User.create({
|
||||
:email => 'admin@ofw.org',
|
||||
:password => 'passw0rd',
|
||||
:password_confirmation => 'passw0rd',
|
||||
:remember_me => false,
|
||||
:persistence_token => 'pass',
|
||||
:login => 'admin@ofw.org',
|
||||
:role_ids => [admin_role.id]})
|
||||
|
||||
visit spree.admin_path
|
||||
fill_in 'user_email', :with => 'admin@ofw.org'
|
||||
fill_in 'user_password', :with => 'passw0rd'
|
||||
click_button 'Login'
|
||||
login_to_admin_section
|
||||
|
||||
click_link 'Suppliers'
|
||||
click_link 'New Supplier'
|
||||
|
||||
18
spec/support/request/authentication_workflow.rb
Normal file
18
spec/support/request/authentication_workflow.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
module AuthenticationWorkflow
|
||||
def login_to_admin_section
|
||||
admin_role = Spree::Role.create(:name => 'admin')
|
||||
admin_user = Spree::User.create({
|
||||
:email => 'admin@ofw.org',
|
||||
:password => 'passw0rd',
|
||||
:password_confirmation => 'passw0rd',
|
||||
:remember_me => false,
|
||||
:persistence_token => 'pass',
|
||||
:login => 'admin@ofw.org',
|
||||
:role_ids => [admin_role.id]})
|
||||
|
||||
visit spree.admin_path
|
||||
fill_in 'user_email', :with => 'admin@ofw.org'
|
||||
fill_in 'user_password', :with => 'passw0rd'
|
||||
click_button 'Login'
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user