mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-12 03:50:22 +00:00
Merge master (with primary taxons restored)
This commit is contained in:
15
spec/features/admin/authentication_spec.rb
Normal file
15
spec/features/admin/authentication_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'spec_helper'
|
||||
|
||||
feature "Authentication", js: true do
|
||||
include UIComponentHelper
|
||||
let(:user) { create(:user, password: "password", password_confirmation: "password") }
|
||||
|
||||
scenario "logging into admin redirects home, then back to admin" do
|
||||
visit spree.admin_path
|
||||
fill_in "Email", with: user.email
|
||||
fill_in "Password", with: user.password
|
||||
click_login_button
|
||||
page.should have_content "Dashboard"
|
||||
current_path.should == spree.admin_path
|
||||
end
|
||||
end
|
||||
@@ -223,20 +223,19 @@ feature %q{
|
||||
scenario "creating a new product" do
|
||||
s = FactoryGirl.create(:supplier_enterprise)
|
||||
d = FactoryGirl.create(:distributor_enterprise)
|
||||
taxon = create(:taxon)
|
||||
|
||||
login_to_admin_section
|
||||
|
||||
visit '/admin/products/bulk_edit'
|
||||
|
||||
#save_screenshot "/Users/willmarshall/Desktop/foo.png"
|
||||
#save_and_open_page
|
||||
find("a", text: "NEW PRODUCT").click
|
||||
|
||||
page.should have_content 'NEW PRODUCT'
|
||||
|
||||
fill_in 'product_name', :with => 'Big Bag Of Apples'
|
||||
select(s.name, :from => 'product_supplier_id')
|
||||
fill_in 'product_price', :with => '10.00'
|
||||
select taxon.name, from: 'product_primary_taxon_id'
|
||||
click_button 'Create'
|
||||
|
||||
URI.parse(current_url).path.should == '/admin/products/bulk_edit'
|
||||
|
||||
@@ -6,6 +6,7 @@ feature %q{
|
||||
} do
|
||||
include AuthenticationWorkflow
|
||||
include WebHelper
|
||||
let!(:taxon) { create(:taxon) }
|
||||
|
||||
background do
|
||||
@supplier = create(:supplier_enterprise, :name => 'New supplier')
|
||||
@@ -22,6 +23,7 @@ feature %q{
|
||||
|
||||
fill_in 'product_name', with: 'A new product !!!'
|
||||
fill_in 'product_price', with: '19.99'
|
||||
select taxon.name, from: "product_primary_taxon_id"
|
||||
select 'New supplier', from: 'product_supplier_id'
|
||||
|
||||
click_button 'Create'
|
||||
@@ -43,6 +45,8 @@ feature %q{
|
||||
|
||||
product.reload
|
||||
product.distributors.sort.should == [@distributors[0], @distributors[2]].sort
|
||||
|
||||
|
||||
product.product_distributions.map { |pd| pd.enterprise_fee }.sort.should == [@enterprise_fees[0], @enterprise_fees[2]].sort
|
||||
end
|
||||
|
||||
@@ -96,6 +100,7 @@ feature %q{
|
||||
|
||||
page.should have_selector('#product_supplier_id')
|
||||
select 'Another Supplier', :from => 'product_supplier_id'
|
||||
select taxon.name, from: "product_primary_taxon_id"
|
||||
|
||||
# Should only have suppliers listed which the user can manage
|
||||
within "#product_supplier_id" do
|
||||
|
||||
Reference in New Issue
Block a user