mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-11 03:40:20 +00:00
Merge pull request #8179 from filipefurtad0/feature_into_system
Feature into system specs
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an administrator
|
||||
I want to manage adjustments on orders
|
||||
', js: true do
|
||||
@@ -28,7 +28,7 @@ feature '
|
||||
create(:check_payment, order: order, amount: order.total)
|
||||
end
|
||||
|
||||
scenario "adding taxed adjustments to an order" do
|
||||
it "adding taxed adjustments to an order" do
|
||||
# When I go to the adjustments page for the order
|
||||
login_as_admin_and_visit spree.admin_orders_path
|
||||
page.find('td.actions a.icon-edit').click
|
||||
@@ -47,7 +47,7 @@ feature '
|
||||
expect(page).to have_selector 'td.tax', text: '10.00'
|
||||
end
|
||||
|
||||
scenario "modifying taxed adjustments on an order" do
|
||||
it "modifying taxed adjustments on an order" do
|
||||
# Given a taxed adjustment
|
||||
adjustment = create(:adjustment, label: "Extra Adjustment", adjustable: order,
|
||||
amount: 110, tax_category: tax_category, order: order)
|
||||
@@ -69,7 +69,7 @@ feature '
|
||||
expect(page).to have_selector 'td.tax', text: '0.00'
|
||||
end
|
||||
|
||||
scenario "modifying an untaxed adjustment on an order" do
|
||||
it "modifying an untaxed adjustment on an order" do
|
||||
# Given an untaxed adjustment
|
||||
adjustment = create(:adjustment, label: "Extra Adjustment", adjustable: order,
|
||||
amount: 110, tax_category: nil, order: order)
|
||||
@@ -91,7 +91,7 @@ feature '
|
||||
expect(page).to have_selector 'td.tax', text: '10.00'
|
||||
end
|
||||
|
||||
scenario "viewing adjustments on a canceled order" do
|
||||
it "viewing adjustments on a canceled order" do
|
||||
# Given a taxed adjustment
|
||||
adjustment = create(:adjustment, label: "Extra Adjustment", adjustable: order,
|
||||
amount: 110, tax_category: tax_category, order: order)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "Authentication", js: true do
|
||||
describe "Authentication", js: true do
|
||||
include UIComponentHelper
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
@@ -10,7 +10,7 @@ feature "Authentication", js: true do
|
||||
let(:user) { create(:user, password: "password", password_confirmation: "password") }
|
||||
let!(:enterprise) { create(:enterprise, owner: user) } # Required for access to admin
|
||||
|
||||
scenario "logging into admin redirects home, then back to admin" do
|
||||
it "logging into admin redirects home, then back to admin" do
|
||||
visit spree.admin_dashboard_path
|
||||
|
||||
fill_in "Email", with: user.email
|
||||
@@ -21,7 +21,7 @@ feature "Authentication", js: true do
|
||||
expect(page).to have_no_content "CONFIGURATION"
|
||||
end
|
||||
|
||||
scenario "viewing my account" do
|
||||
it "viewing my account" do
|
||||
login_to_admin_section
|
||||
click_link "Account"
|
||||
expect(page).to have_current_path spree.account_path
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an Administrator
|
||||
I want to be able to manage orders in bulk
|
||||
', js: true do
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an Administrator
|
||||
I want to be able to manage products in bulk
|
||||
', js: true do
|
||||
@@ -200,7 +200,7 @@ feature '
|
||||
end
|
||||
end
|
||||
|
||||
scenario "creating a new product" do
|
||||
it "creating a new product" do
|
||||
create(:stock_location, backorderable_default: false)
|
||||
|
||||
supplier = create(:supplier_enterprise)
|
||||
@@ -227,7 +227,7 @@ feature '
|
||||
expect(page).to have_field "product_name", with: 'Big Bag Of Apples'
|
||||
end
|
||||
|
||||
scenario "creating new variants" do
|
||||
it "creating new variants" do
|
||||
# Given a product without variants or a unit
|
||||
p = FactoryBot.create(:product, variant_unit: 'weight', variant_unit_scale: 1000)
|
||||
login_as_admin
|
||||
@@ -274,7 +274,7 @@ feature '
|
||||
expect(page).to have_selector "a.edit-variant", visible: true
|
||||
end
|
||||
|
||||
scenario "updating product attributes" do
|
||||
it "updating product attributes" do
|
||||
s1 = FactoryBot.create(:supplier_enterprise)
|
||||
s2 = FactoryBot.create(:supplier_enterprise)
|
||||
t1 = FactoryBot.create(:taxon)
|
||||
@@ -319,7 +319,7 @@ feature '
|
||||
expect(p.sku).to eq "NEW SKU"
|
||||
end
|
||||
|
||||
scenario "updating a product with a variant unit of 'items'" do
|
||||
it "updating a product with a variant unit of 'items'" do
|
||||
p = FactoryBot.create(:product, variant_unit: 'weight', variant_unit_scale: 1000)
|
||||
|
||||
login_as_admin
|
||||
@@ -339,7 +339,7 @@ feature '
|
||||
expect(p.variant_unit_name).to eq "loaf"
|
||||
end
|
||||
|
||||
scenario "updating a product with variants" do
|
||||
it "updating a product with variants" do
|
||||
s1 = FactoryBot.create(:supplier_enterprise)
|
||||
s2 = FactoryBot.create(:supplier_enterprise)
|
||||
p = FactoryBot.create(:product, supplier: s1, available_on: Date.current, variant_unit: 'volume', variant_unit_scale: 0.001,
|
||||
@@ -381,7 +381,7 @@ feature '
|
||||
expect(v.unit_description).to eq "(8x250 mL bottles)"
|
||||
end
|
||||
|
||||
scenario "updating delegated attributes of variants in isolation" do
|
||||
it "updating delegated attributes of variants in isolation" do
|
||||
p = FactoryBot.create(:product)
|
||||
v = FactoryBot.create(:variant, product: p, price: 3.0)
|
||||
|
||||
@@ -406,7 +406,7 @@ feature '
|
||||
expect(v.price).to eq 10.0
|
||||
end
|
||||
|
||||
scenario "updating a product mutiple times without refresh" do
|
||||
it "updating a product mutiple times without refresh" do
|
||||
p = FactoryBot.create(:product, name: 'original name')
|
||||
login_as_admin
|
||||
|
||||
@@ -439,7 +439,7 @@ feature '
|
||||
expect(p.name).to eq "original name"
|
||||
end
|
||||
|
||||
scenario "updating a product after cloning a product" do
|
||||
it "updating a product after cloning a product" do
|
||||
p = FactoryBot.create(:product, name: "product 1")
|
||||
login_as_admin
|
||||
|
||||
@@ -462,7 +462,7 @@ feature '
|
||||
expect(p.name).to eq "new product name"
|
||||
end
|
||||
|
||||
scenario "updating when a filter has been applied" do
|
||||
it "updating when a filter has been applied" do
|
||||
s1 = create(:supplier_enterprise)
|
||||
s2 = create(:supplier_enterprise)
|
||||
p1 = FactoryBot.create(:simple_product, name: "product1", supplier: s1)
|
||||
|
||||
@@ -11,7 +11,7 @@ describe "Zones" do
|
||||
Spree::Zone.delete_all
|
||||
end
|
||||
|
||||
scenario "list existing zones" do
|
||||
it "list existing zones" do
|
||||
visit spree.edit_admin_general_settings_path
|
||||
create(:zone, name: "eastern", description: "zone is eastern")
|
||||
create(:zone, name: "western", description: "cool san fran")
|
||||
@@ -27,7 +27,7 @@ describe "Zones" do
|
||||
within_row(2) { expect(page).to have_content("eastern") }
|
||||
end
|
||||
|
||||
scenario "create a new zone" do
|
||||
it "create a new zone" do
|
||||
visit spree.admin_zones_path
|
||||
click_link "admin_new_zone_link"
|
||||
expect(page).to have_content("New Zone")
|
||||
@@ -39,7 +39,7 @@ describe "Zones" do
|
||||
expect(page).to have_content("successfully created!")
|
||||
end
|
||||
|
||||
scenario "edit existing zone" do
|
||||
it "edit existing zone" do
|
||||
zone = create(:zone_with_member)
|
||||
visit spree.edit_admin_zone_path(zone.id)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'Customers' do
|
||||
describe 'Customers' do
|
||||
include AdminHelper
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an administrator
|
||||
I want to manage enterprise fees
|
||||
', js: true do
|
||||
@@ -11,7 +11,7 @@ feature '
|
||||
|
||||
let!(:tax_category_gst) { create(:tax_category, name: 'GST') }
|
||||
|
||||
scenario "listing enterprise fees" do
|
||||
it "listing enterprise fees" do
|
||||
fee = create(:enterprise_fee, name: '$0.50 / kg', fee_type: 'packing',
|
||||
tax_category: tax_category_gst)
|
||||
amount = fee.calculator.preferred_amount
|
||||
@@ -30,7 +30,7 @@ feature '
|
||||
expect(page).to have_selector "input[value='#{amount}']"
|
||||
end
|
||||
|
||||
scenario "creating an enterprise fee" do
|
||||
it "creating an enterprise fee" do
|
||||
# Given an enterprise
|
||||
e = create(:supplier_enterprise, name: 'Feedme')
|
||||
|
||||
@@ -58,7 +58,7 @@ feature '
|
||||
expect(page).to have_selector "#sets_enterprise_fee_set_collection_attributes_0_calculator_attributes_preferred_flat_percent[value='12.34']"
|
||||
end
|
||||
|
||||
scenario "editing an enterprise fee" do
|
||||
it "editing an enterprise fee" do
|
||||
# Given an enterprise fee
|
||||
fee = create(:enterprise_fee)
|
||||
enterprise = create(:enterprise, name: 'Foo')
|
||||
@@ -96,7 +96,7 @@ feature '
|
||||
expect(fee.inherits_tax_category).to eq(true)
|
||||
end
|
||||
|
||||
scenario "deleting an enterprise fee" do
|
||||
it "deleting an enterprise fee" do
|
||||
# Given an enterprise fee
|
||||
fee = create(:enterprise_fee)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an administrator
|
||||
I want to manage enterprise groups
|
||||
' do
|
||||
@@ -13,7 +13,7 @@ feature '
|
||||
login_to_admin_section
|
||||
end
|
||||
|
||||
scenario "listing enterprise groups" do
|
||||
it "listing enterprise groups" do
|
||||
e = create(:enterprise)
|
||||
group = create(:enterprise_group, enterprises: [e], on_front_page: true)
|
||||
|
||||
@@ -24,7 +24,7 @@ feature '
|
||||
expect(page).to have_selector 'td', text: e.name
|
||||
end
|
||||
|
||||
scenario "creating a new enterprise group", js: true do
|
||||
it "creating a new enterprise group", js: true do
|
||||
e1 = create(:enterprise)
|
||||
e2 = create(:enterprise)
|
||||
e3 = create(:enterprise)
|
||||
@@ -55,7 +55,7 @@ feature '
|
||||
expect(eg.enterprises).to match_array [e1, e2]
|
||||
end
|
||||
|
||||
scenario "editing an enterprise group" do
|
||||
it "editing an enterprise group" do
|
||||
e1 = create(:enterprise)
|
||||
e2 = create(:enterprise)
|
||||
eg = create(:enterprise_group, name: 'EGEGEG', on_front_page: true, enterprises: [e1, e2])
|
||||
@@ -82,7 +82,7 @@ feature '
|
||||
expect(eg.enterprises).to eq([e2])
|
||||
end
|
||||
|
||||
scenario "re-ordering enterprise groups" do
|
||||
it "re-ordering enterprise groups" do
|
||||
eg1 = create(:enterprise_group, name: 'A')
|
||||
eg2 = create(:enterprise_group, name: 'B')
|
||||
|
||||
@@ -95,7 +95,7 @@ feature '
|
||||
expect(page.all('td.name').map(&:text)).to eq(['A', 'B'])
|
||||
end
|
||||
|
||||
scenario "deleting an enterprise group", js: true do
|
||||
it "deleting an enterprise group", js: true do
|
||||
eg = create(:enterprise_group, name: 'EGEGEG')
|
||||
|
||||
click_link 'Groups'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an Administrator
|
||||
I want to manage relationships between enterprises
|
||||
', js: true do
|
||||
@@ -12,7 +12,7 @@ feature '
|
||||
context "as a site administrator" do
|
||||
before { login_as_admin }
|
||||
|
||||
scenario "listing relationships" do
|
||||
it "listing relationships" do
|
||||
# Given some enterprises with relationships
|
||||
e1, e2, e3, e4 = create(:enterprise), create(:enterprise), create(:enterprise),
|
||||
create(:enterprise)
|
||||
@@ -35,7 +35,7 @@ create(:enterprise)
|
||||
end
|
||||
end
|
||||
|
||||
scenario "creating a relationship" do
|
||||
it "creating a relationship" do
|
||||
e1 = create(:enterprise, name: 'One')
|
||||
e2 = create(:enterprise, name: 'Two')
|
||||
|
||||
@@ -60,7 +60,7 @@ create(:enterprise)
|
||||
'create_variant_overrides']
|
||||
end
|
||||
|
||||
scenario "attempting to create a relationship with invalid data" do
|
||||
it "attempting to create a relationship with invalid data" do
|
||||
e1 = create(:enterprise, name: 'One')
|
||||
e2 = create(:enterprise, name: 'Two')
|
||||
create(:enterprise_relationship, parent: e1, child: e2)
|
||||
@@ -77,7 +77,7 @@ create(:enterprise)
|
||||
end.to change(EnterpriseRelationship, :count).by(0)
|
||||
end
|
||||
|
||||
scenario "deleting a relationship" do
|
||||
it "deleting a relationship" do
|
||||
e1 = create(:enterprise, name: 'One')
|
||||
e2 = create(:enterprise, name: 'Two')
|
||||
er = create(:enterprise_relationship, parent: e1, child: e2,
|
||||
@@ -107,7 +107,7 @@ create(:enterprise)
|
||||
|
||||
before { login_as enterprise_user }
|
||||
|
||||
scenario "enterprise user can only see relationships involving their enterprises" do
|
||||
it "enterprise user can only see relationships involving their enterprises" do
|
||||
visit admin_enterprise_relationships_path
|
||||
|
||||
expect(page).to have_relationship d1, d2
|
||||
@@ -115,7 +115,7 @@ create(:enterprise)
|
||||
expect(page).not_to have_relationship d2, d3
|
||||
end
|
||||
|
||||
scenario "enterprise user can only add their own enterprises as parent" do
|
||||
it "enterprise user can only add their own enterprises as parent" do
|
||||
visit admin_enterprise_relationships_path
|
||||
expect(page).to have_select2 'enterprise_relationship_parent_id', options: ['', d1.name]
|
||||
expect(page).to have_select2 'enterprise_relationship_child_id',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an Administrator
|
||||
I want to manage relationships between users and enterprises
|
||||
', js: true do
|
||||
@@ -13,7 +13,7 @@ feature '
|
||||
context "as a site administrator" do
|
||||
before { login_to_admin_section }
|
||||
|
||||
scenario "listing relationships" do
|
||||
it "listing relationships" do
|
||||
# Given some users and enterprises with relationships
|
||||
u1, u2 = create(:user), create(:user)
|
||||
e1, e2, e3, e4 = create(:enterprise), create(:enterprise), create(:enterprise),
|
||||
@@ -36,7 +36,7 @@ create(:enterprise)
|
||||
end
|
||||
end
|
||||
|
||||
scenario "creating a relationship" do
|
||||
it "creating a relationship" do
|
||||
u = create(:user, email: 'u@example.com')
|
||||
e = create(:enterprise, name: 'One')
|
||||
|
||||
@@ -51,7 +51,7 @@ create(:enterprise)
|
||||
expect(EnterpriseRole.where(user_id: u, enterprise_id: e)).to be_present
|
||||
end
|
||||
|
||||
scenario "attempting to create a relationship with invalid data" do
|
||||
it "attempting to create a relationship with invalid data" do
|
||||
u = create(:user, email: 'u@example.com')
|
||||
e = create(:enterprise, name: 'One')
|
||||
create(:enterprise_role, user: u, enterprise: e)
|
||||
@@ -68,7 +68,7 @@ create(:enterprise)
|
||||
end.to change(EnterpriseRole, :count).by(0)
|
||||
end
|
||||
|
||||
scenario "deleting a relationship" do
|
||||
it "deleting a relationship" do
|
||||
u = create(:user, email: 'u@example.com')
|
||||
e = create(:enterprise, name: 'One')
|
||||
er = create(:enterprise_role, user: u, enterprise: e)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As a Super User
|
||||
I want to setup users to manage an enterprise
|
||||
' do
|
||||
@@ -21,7 +21,7 @@ feature '
|
||||
|
||||
describe "creating an enterprise user" do
|
||||
context "with a limitted number of owned enterprises" do
|
||||
scenario "setting the enterprise ownership limit" do
|
||||
it "setting the enterprise ownership limit" do
|
||||
expect(user.enterprise_limit).to eq 5
|
||||
login_as_admin_and_visit spree.admin_users_path
|
||||
click_link user.email
|
||||
@@ -41,12 +41,12 @@ feature '
|
||||
login_as user
|
||||
end
|
||||
|
||||
scenario "should not be able to see system configuration" do
|
||||
it "should not be able to see system configuration" do
|
||||
visit spree.edit_admin_general_settings_path
|
||||
expect(page).to have_content 'Unauthorized'
|
||||
end
|
||||
|
||||
scenario "should not be able to see user management" do
|
||||
it "should not be able to see user management" do
|
||||
visit spree.admin_users_path
|
||||
expect(page).to have_content 'Unauthorized'
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
feature "Managing enterprise images" do
|
||||
describe "Managing enterprise images" do
|
||||
include WebHelper
|
||||
include AuthenticationHelper
|
||||
|
||||
@@ -28,7 +28,7 @@ feature "Managing enterprise images" do
|
||||
go_to_images
|
||||
end
|
||||
|
||||
scenario "editing logo" do
|
||||
it "editing logo" do
|
||||
# Adding image
|
||||
attach_file "enterprise[logo]", Rails.root.join("app", "assets", "images", "logo-white.png")
|
||||
click_button "Update"
|
||||
@@ -64,7 +64,7 @@ feature "Managing enterprise images" do
|
||||
end
|
||||
end
|
||||
|
||||
scenario "editing promo image" do
|
||||
it "editing promo image" do
|
||||
# Adding image
|
||||
attach_file "enterprise[promo_image]",
|
||||
Rails.root.join("app", "assets", "images", "logo-white.png")
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'Enterprises Index' do
|
||||
describe 'Enterprises Index' do
|
||||
include WebHelper
|
||||
include AuthenticationHelper
|
||||
|
||||
context "as an admin user" do
|
||||
scenario "listing enterprises" do
|
||||
it "listing enterprises" do
|
||||
s = create(:supplier_enterprise)
|
||||
d = create(:distributor_enterprise)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
feature "Uploading Terms and Conditions PDF" do
|
||||
describe "Uploading Terms and Conditions PDF" do
|
||||
include AuthenticationHelper
|
||||
|
||||
context "as an Enterprise user", js: true do
|
||||
@@ -38,7 +38,7 @@ feature "Uploading Terms and Conditions PDF" do
|
||||
FileUtils.rm_f(black_pdf_file_name)
|
||||
end
|
||||
|
||||
scenario "uploading terms and conditions" do
|
||||
it "uploading terms and conditions" do
|
||||
go_to_business_details
|
||||
|
||||
# Add PDF
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an administrator
|
||||
I want to manage enterprises
|
||||
' do
|
||||
include WebHelper
|
||||
include AuthenticationHelper
|
||||
|
||||
scenario "viewing an enterprise" do
|
||||
it "viewing an enterprise" do
|
||||
e = create(:enterprise)
|
||||
|
||||
login_to_admin_section
|
||||
@@ -19,7 +19,7 @@ feature '
|
||||
expect(page).to have_content e.name
|
||||
end
|
||||
|
||||
scenario "creating a new enterprise", js: true do
|
||||
it "creating a new enterprise", js: true do
|
||||
eg1 = create(:enterprise_group, name: 'eg1')
|
||||
eg2 = create(:enterprise_group, name: 'eg2')
|
||||
payment_method = create(:payment_method)
|
||||
@@ -60,7 +60,7 @@ feature '
|
||||
expect(flash_message).to eq('Enterprise "Eaterprises" has been successfully created!')
|
||||
end
|
||||
|
||||
scenario "editing an existing enterprise", js: true do
|
||||
it "editing an existing enterprise", js: true do
|
||||
@enterprise = create(:enterprise)
|
||||
e2 = create(:enterprise)
|
||||
eg1 = create(:enterprise_group, name: 'eg1')
|
||||
@@ -344,7 +344,7 @@ feature '
|
||||
select2_select 'Victoria', from: 'enterprise_address_attributes_state_id'
|
||||
end
|
||||
|
||||
scenario "without violating rules" do
|
||||
it "without violating rules" do
|
||||
click_button 'Create'
|
||||
|
||||
# Then it should be created
|
||||
@@ -372,7 +372,7 @@ feature '
|
||||
end
|
||||
end
|
||||
|
||||
scenario "editing enterprises I manage" do
|
||||
it "editing enterprises I manage" do
|
||||
visit admin_enterprises_path
|
||||
within("tbody#e_#{distributor1.id}") { click_link 'Settings' }
|
||||
|
||||
@@ -415,7 +415,7 @@ feature '
|
||||
end
|
||||
end
|
||||
|
||||
scenario "managing producer properties" do
|
||||
it "managing producer properties" do
|
||||
create(:property, name: "Certified Organic")
|
||||
visit admin_enterprises_path
|
||||
within("#e_#{supplier1.id}") { click_link 'Settings' }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an administrator
|
||||
I want to print a invoice as PDF
|
||||
', js: false do
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'Multilingual', js: true do
|
||||
describe 'Multilingual', js: true do
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
let(:admin_role) { Spree::Role.find_or_create_by!(name: 'admin') }
|
||||
let(:admin_user) { create(:user) }
|
||||
|
||||
background do
|
||||
before do
|
||||
admin_user.spree_roles << admin_role
|
||||
login_as admin_user
|
||||
visit spree.admin_dashboard_path
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an administrator
|
||||
I want to create/update complex order cycles with a specific time
|
||||
', js: true do
|
||||
@@ -13,7 +13,7 @@ feature '
|
||||
let(:order_cycle_opening_time) { 1.day.from_now(Time.zone.now) }
|
||||
let(:order_cycle_closing_time) { 2.day.from_now(Time.zone.now) }
|
||||
|
||||
scenario "creating an order cycle with full interface", js: true do
|
||||
it "creating an order cycle with full interface", js: true do
|
||||
# Given coordinating, supplying and distributing enterprises with some products with variants
|
||||
coordinator = create(:distributor_enterprise, name: 'My coordinator')
|
||||
supplier = create(:supplier_enterprise, name: 'My supplier')
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an administrator
|
||||
I want to manage complex order cycles
|
||||
', js: true do
|
||||
@@ -10,7 +10,7 @@ feature '
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
|
||||
scenario "editing an order cycle with an exchange between the same enterprise" do
|
||||
it "editing an order cycle with an exchange between the same enterprise" do
|
||||
c = create(:distributor_enterprise, is_primary_producer: true)
|
||||
|
||||
# Given two order cycles, one with a mono-enterprise incoming exchange...
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an administrator
|
||||
I want to manage complex order cycles
|
||||
', js: true do
|
||||
@@ -28,13 +28,13 @@ feature '
|
||||
expect(page).to_not have_content new_product.name
|
||||
end
|
||||
|
||||
scenario "load all products" do
|
||||
it "load all products" do
|
||||
page.find(".exchange-load-all-variants a").click
|
||||
|
||||
expect_all_products_loaded
|
||||
end
|
||||
|
||||
scenario "select all products" do
|
||||
it "select all products" do
|
||||
# replace with scroll_to method when upgrading to Capybara >= 3.13.0
|
||||
checkbox_id = "order_cycle_incoming_exchange_0_select_all_variants"
|
||||
page.execute_script("document.getElementById('#{checkbox_id}').scrollIntoView()")
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an administrator
|
||||
I want to manage complex order cycles
|
||||
', js: true do
|
||||
@@ -10,7 +10,7 @@ feature '
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
|
||||
scenario "editing an order cycle" do
|
||||
it "editing an order cycle" do
|
||||
# Given an order cycle with all the settings
|
||||
oc = create(:order_cycle)
|
||||
oc.suppliers.first.update_attribute :name, 'AAA'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
xfeature '
|
||||
xdescribe '
|
||||
As an administrator
|
||||
I want to create/update complex order cycles with a specific time
|
||||
', js: true do
|
||||
@@ -17,7 +17,7 @@ xfeature '
|
||||
Time.zone.local(2040, 11, 13, 17, 0o0, 0o0).strftime("%F %T %z")
|
||||
}
|
||||
|
||||
scenario "updating an order cycle", js: true do
|
||||
it "updating an order cycle", js: true do
|
||||
# Given an order cycle with all the settings
|
||||
oc = create(:order_cycle)
|
||||
initial_variants = oc.variants.sort_by(&:id)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an administrator
|
||||
I want to list and filter order cycles
|
||||
', js: true do
|
||||
@@ -10,7 +10,7 @@ feature '
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
|
||||
scenario "listing and filtering order cycles" do
|
||||
it "listing and filtering order cycles" do
|
||||
# Given some order cycles (created in an arbitrary order)
|
||||
oc4 = create(:simple_order_cycle, name: 'oc4',
|
||||
orders_open_at: 2.days.from_now, orders_close_at: 1.month.from_now)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an administrator
|
||||
I want to manage simple order cycles
|
||||
', js: true do
|
||||
@@ -10,7 +10,7 @@ feature '
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
|
||||
scenario "updating many order cycle opening/closing times at once", js: true do
|
||||
it "updating many order cycle opening/closing times at once", js: true do
|
||||
# Given three order cycles
|
||||
oc1 = create(:simple_order_cycle,
|
||||
orders_open_at: Time.zone.local(2000, 12, 12, 12, 12, 0),
|
||||
@@ -71,7 +71,7 @@ feature '
|
||||
expect(order_cycles.map { |oc| oc.orders_close_at.sec }).to eq [1, 3, 0]
|
||||
end
|
||||
|
||||
scenario "cloning an order cycle" do
|
||||
it "cloning an order cycle" do
|
||||
# Given an order cycle
|
||||
oc = create(:simple_order_cycle)
|
||||
|
||||
@@ -177,7 +177,7 @@ feature '
|
||||
login_as @new_user
|
||||
end
|
||||
|
||||
scenario "viewing a list of order cycles I am coordinating" do
|
||||
it "viewing a list of order cycles I am coordinating" do
|
||||
oc_user_coordinating = create(:simple_order_cycle,
|
||||
suppliers: [supplier_managed, supplier_unmanaged], coordinator: distributor_managed, distributors: [distributor_managed, distributor_unmanaged], name: 'Order Cycle 1' )
|
||||
oc_for_other_user = create(:simple_order_cycle, coordinator: supplier_unmanaged,
|
||||
@@ -199,7 +199,7 @@ feature '
|
||||
expect(page).to have_selector 'td.shops', text: distributor_unmanaged.name
|
||||
end
|
||||
|
||||
scenario "creating a new order cycle" do
|
||||
it "creating a new order cycle" do
|
||||
distributor_managed.update_attribute(:enable_subscriptions, true)
|
||||
visit admin_order_cycles_path
|
||||
click_link 'New Order Cycle'
|
||||
@@ -272,7 +272,7 @@ feature '
|
||||
expect(exchange.tag_list).to eq(["wholesale"])
|
||||
end
|
||||
|
||||
scenario "editing an order cycle" do
|
||||
it "editing an order cycle" do
|
||||
oc = create(:simple_order_cycle,
|
||||
suppliers: [supplier_managed, supplier_permitted, supplier_unmanaged], coordinator: distributor_managed, distributors: [distributor_managed, distributor_permitted, distributor_unmanaged], name: 'Order Cycle 1' )
|
||||
distributor_managed.update_attribute(:enable_subscriptions, true)
|
||||
@@ -304,7 +304,7 @@ feature '
|
||||
expect(oc.schedules).to eq([schedule])
|
||||
end
|
||||
|
||||
scenario "cloning an order cycle" do
|
||||
it "cloning an order cycle" do
|
||||
oc = create(:simple_order_cycle, coordinator: distributor_managed)
|
||||
|
||||
visit admin_order_cycles_path
|
||||
@@ -327,7 +327,7 @@ feature '
|
||||
login_to_admin_as new_user
|
||||
end
|
||||
|
||||
scenario "editing an order cycle" do
|
||||
it "editing an order cycle" do
|
||||
oc = create(:simple_order_cycle,
|
||||
suppliers: [supplier_managed, supplier_permitted, supplier_unmanaged], coordinator: distributor_managed, distributors: [distributor_managed, distributor_permitted, distributor_unmanaged], name: 'Order Cycle 1' )
|
||||
v1 = create(:variant, product: create(:product, supplier: supplier_managed) )
|
||||
@@ -403,7 +403,7 @@ feature '
|
||||
login_to_admin_as new_user
|
||||
end
|
||||
|
||||
scenario "editing an order cycle" do
|
||||
it "editing an order cycle" do
|
||||
oc = create(:simple_order_cycle,
|
||||
suppliers: [supplier_managed, supplier_permitted, supplier_unmanaged], coordinator: distributor_managed, distributors: [my_distributor, distributor_managed, distributor_permitted, distributor_unmanaged], name: 'Order Cycle 1' )
|
||||
v1 = create(:variant, product: create(:product, supplier: supplier_managed) )
|
||||
@@ -558,7 +558,7 @@ feature '
|
||||
expect(ex.pickup_instructions).to eq('pickup instructions')
|
||||
end
|
||||
|
||||
scenario "editing an order cycle" do
|
||||
it "editing an order cycle" do
|
||||
# Given an order cycle with pickup time and instructions
|
||||
fee = create(:enterprise_fee, name: 'my fee', enterprise: enterprise)
|
||||
oc = create(:simple_order_cycle, suppliers: [enterprise], coordinator: enterprise,
|
||||
@@ -593,7 +593,7 @@ feature '
|
||||
expect(page).to have_select 'order_cycle_coordinator_fee_0_id', selected: 'my fee'
|
||||
end
|
||||
|
||||
scenario "updating an order cycle" do
|
||||
it "updating an order cycle" do
|
||||
# Given an order cycle with pickup time and instructions
|
||||
fee1 = create(:enterprise_fee, name: 'my fee', enterprise: enterprise)
|
||||
fee2 = create(:enterprise_fee, name: 'that fee', enterprise: enterprise)
|
||||
@@ -657,7 +657,7 @@ feature '
|
||||
end
|
||||
end
|
||||
|
||||
scenario "modify the minute of a order cycle with the keyboard, check that the modifications are taken into account" do
|
||||
it "modify the minute of a order cycle with the keyboard, check that the modifications are taken into account" do
|
||||
order_cycle = create(:simple_order_cycle, name: "Translusent Berries")
|
||||
login_as_admin_and_visit admin_order_cycles_path
|
||||
find("#oc#{order_cycle.id}_orders_close_at").click
|
||||
@@ -667,7 +667,7 @@ feature '
|
||||
expect(page).to have_content "You have unsaved changes"
|
||||
end
|
||||
|
||||
scenario "deleting an order cycle" do
|
||||
it "deleting an order cycle" do
|
||||
order_cycle = create(:simple_order_cycle, name: "Translusent Berries")
|
||||
login_as_admin_and_visit admin_order_cycles_path
|
||||
expect(page).to have_selector "tr.order-cycle-#{order_cycle.id}"
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an administrator
|
||||
I want to be alerted when I navigate away from a dirty order cycle form
|
||||
', js: true do
|
||||
include AuthenticationHelper
|
||||
|
||||
scenario "alert when navigating away from dirty form" do
|
||||
it "alert when navigating away from dirty form" do
|
||||
# Given a 'complex' order cycle form
|
||||
oc = create(:order_cycle)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an administrator
|
||||
I want to print a ticket for an order
|
||||
', js: true do
|
||||
@@ -32,8 +32,8 @@ feature '
|
||||
Spree::Config[:enable_receipt_printing?] = true
|
||||
end
|
||||
|
||||
feature "viewing the edit page" do
|
||||
scenario "can print an order's ticket" do
|
||||
describe "viewing the edit page" do
|
||||
it "can print an order's ticket" do
|
||||
visit spree.edit_admin_order_path(order)
|
||||
|
||||
find("#links-dropdown .ofn-drop-down").click
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an administrator
|
||||
I want to create and edit orders
|
||||
', js: true do
|
||||
@@ -39,7 +39,7 @@ feature '
|
||||
click_button 'Next'
|
||||
end
|
||||
|
||||
scenario "creating an order with distributor and order cycle" do
|
||||
it "creating an order with distributor and order cycle" do
|
||||
distributor_disabled = create(:distributor_enterprise)
|
||||
create(:simple_order_cycle, name: 'Two')
|
||||
|
||||
@@ -84,7 +84,7 @@ feature '
|
||||
expect(o.order_cycle).to eq(order_cycle)
|
||||
end
|
||||
|
||||
scenario "can add a product to an existing order" do
|
||||
it "can add a product to an existing order" do
|
||||
login_as_admin_and_visit spree.edit_admin_order_path(order)
|
||||
|
||||
select2_select product.name, from: 'add_variant_id', search: true
|
||||
@@ -95,7 +95,7 @@ feature '
|
||||
expect(order.line_items.reload.map(&:product)).to include product
|
||||
end
|
||||
|
||||
scenario "displays error when incorrect distribution for products is chosen" do
|
||||
it "displays error when incorrect distribution for products is chosen" do
|
||||
d = create(:distributor_enterprise)
|
||||
oc = create(:simple_order_cycle, distributors: [d])
|
||||
|
||||
@@ -118,7 +118,7 @@ feature '
|
||||
"cannot supply the products in your cart"
|
||||
end
|
||||
|
||||
scenario "can't add products to an order outside the order's hub and order cycle" do
|
||||
it "can't add products to an order outside the order's hub and order cycle" do
|
||||
product = create(:simple_product)
|
||||
|
||||
login_as_admin_and_visit spree.edit_admin_order_path(order)
|
||||
@@ -126,7 +126,7 @@ feature '
|
||||
expect(page).not_to have_select2 "add_variant_id", with_options: [product.name]
|
||||
end
|
||||
|
||||
scenario "can't add more items than are available" do
|
||||
it "can't add more items than are available" do
|
||||
# Move the order back to the cart state
|
||||
order.state = 'cart'
|
||||
order.completed_at = nil
|
||||
@@ -153,7 +153,7 @@ feature '
|
||||
expect(order.reload.line_items.first.quantity).to eq(max_quantity)
|
||||
end
|
||||
|
||||
scenario "there are infinite items available (variant is on demand)" do
|
||||
it "there are infinite items available (variant is on demand)" do
|
||||
# Move the order back to the cart state
|
||||
order.state = 'cart'
|
||||
order.completed_at = nil
|
||||
@@ -233,7 +233,7 @@ feature '
|
||||
end
|
||||
end
|
||||
|
||||
scenario "can't change distributor or order cycle once order has been finalized" do
|
||||
it "can't change distributor or order cycle once order has been finalized" do
|
||||
login_as_admin_and_visit spree.edit_admin_order_path(order)
|
||||
|
||||
expect(page).not_to have_select2 'order_distributor_id'
|
||||
@@ -243,7 +243,7 @@ feature '
|
||||
expect(page).to have_selector 'p', text: "Order cycle: #{order.order_cycle.name}"
|
||||
end
|
||||
|
||||
scenario "filling customer details" do
|
||||
it "filling customer details" do
|
||||
# Given a customer with an order, which includes their shipping and billing address
|
||||
|
||||
# We change the 1st order's address details, this way
|
||||
@@ -303,7 +303,7 @@ feature '
|
||||
login_as @enterprise_user
|
||||
end
|
||||
|
||||
feature "viewing the edit page" do
|
||||
describe "viewing the edit page" do
|
||||
let!(:shipping_method_for_distributor1) do
|
||||
create(:shipping_method, name: "Normal", distributors: [distributor1])
|
||||
end
|
||||
@@ -316,13 +316,13 @@ feature '
|
||||
end
|
||||
end
|
||||
|
||||
background do
|
||||
before do
|
||||
distributor1.update_attribute(:abn, '12345678')
|
||||
|
||||
visit spree.edit_admin_order_path(order)
|
||||
end
|
||||
|
||||
scenario "verifying page contents" do
|
||||
it "verifying page contents" do
|
||||
# shows a list of line_items
|
||||
within('table.index tbody', match: :first) do
|
||||
order.line_items.each do |item|
|
||||
@@ -365,7 +365,7 @@ feature '
|
||||
end
|
||||
end
|
||||
|
||||
scenario "cannot split the order in different stock locations" do
|
||||
it "cannot split the order in different stock locations" do
|
||||
# There's only 1 stock location in OFN,
|
||||
# so the split functionality that comes with spree should be hidden
|
||||
expect(page).to_not have_selector '.split-item'
|
||||
@@ -379,7 +379,7 @@ feature '
|
||||
create(:shipping_method, name: "Other", distributors: [distributor2])
|
||||
end
|
||||
|
||||
scenario "can edit shipping method" do
|
||||
it "can edit shipping method" do
|
||||
visit spree.edit_admin_order_path(order)
|
||||
|
||||
expect(page).to_not have_content different_shipping_method_for_distributor1.name
|
||||
@@ -398,7 +398,7 @@ feature '
|
||||
end
|
||||
end
|
||||
|
||||
scenario "can edit tracking number" do
|
||||
it "can edit tracking number" do
|
||||
test_tracking_number = "ABCCBA"
|
||||
expect(page).to_not have_content test_tracking_number
|
||||
|
||||
@@ -409,7 +409,7 @@ feature '
|
||||
expect(page).to have_content test_tracking_number
|
||||
end
|
||||
|
||||
scenario "viewing shipping fees" do
|
||||
it "viewing shipping fees" do
|
||||
shipping_fee = order.shipment_adjustments.first
|
||||
|
||||
click_link "Adjustments"
|
||||
@@ -442,7 +442,7 @@ feature '
|
||||
end
|
||||
end
|
||||
|
||||
scenario "creating an order with distributor and order cycle" do
|
||||
it "creating an order with distributor and order cycle" do
|
||||
new_order_with_distribution(distributor1, order_cycle1)
|
||||
|
||||
expect(page).to have_content 'ADD PRODUCT'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As a backend user
|
||||
I want to be given information about the state of my enterprises, products and order cycles
|
||||
', js: true do
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As a Super Admin
|
||||
I want to be able to set a distributor on each payment method
|
||||
' do
|
||||
include WebHelper
|
||||
include AuthenticationHelper
|
||||
|
||||
background do
|
||||
before do
|
||||
@distributors = (1..3).map { create(:distributor_enterprise) }
|
||||
end
|
||||
|
||||
describe "creating a payment method", js: true do
|
||||
scenario "assigning a distributor to the payment method" do
|
||||
it "assigning a distributor to the payment method" do
|
||||
login_as_admin_and_visit spree.edit_admin_general_settings_path
|
||||
click_link 'Payment Methods'
|
||||
click_link 'New Payment Method'
|
||||
@@ -97,14 +97,14 @@ feature '
|
||||
end
|
||||
end
|
||||
|
||||
scenario "checking a single distributor is checked by default" do
|
||||
it "checking a single distributor is checked by default" do
|
||||
2.times.each { Enterprise.last.destroy }
|
||||
login_as_admin_and_visit spree.new_admin_payment_method_path
|
||||
expect(page).to have_field "payment_method_distributor_ids_#{@distributors[0].id}",
|
||||
checked: true
|
||||
end
|
||||
|
||||
scenario "checking more than a distributor displays no default choice" do
|
||||
it "checking more than a distributor displays no default choice" do
|
||||
login_as_admin_and_visit spree.new_admin_payment_method_path
|
||||
expect(page).to have_field "payment_method_distributor_ids_#{@distributors[0].id}",
|
||||
checked: false
|
||||
@@ -115,7 +115,7 @@ feature '
|
||||
end
|
||||
end
|
||||
|
||||
scenario "updating a payment method", js: true do
|
||||
it "updating a payment method", js: true do
|
||||
payment_method = create(:payment_method, distributors: [@distributors[0]],
|
||||
calculator: build(:calculator_flat_rate))
|
||||
login_as_admin_and_visit spree.edit_admin_payment_method_path payment_method
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an admin
|
||||
I want to manage payments
|
||||
' do
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an hub manager
|
||||
I want to make Stripe payments
|
||||
' do
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'spec_helper'
|
||||
require 'open_food_network/permissions'
|
||||
|
||||
feature "Product Import", js: true do
|
||||
describe "Product Import", js: true do
|
||||
include AdminHelper
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an admin
|
||||
I want to set a supplier and distributor(s) for a product
|
||||
' do
|
||||
@@ -13,7 +13,7 @@ feature '
|
||||
let!(:stock_location) { create(:stock_location, backorderable_default: false) }
|
||||
let!(:shipping_category) { DefaultShippingCategory.find_or_create }
|
||||
|
||||
background do
|
||||
before do
|
||||
@supplier = create(:supplier_enterprise, name: 'New supplier')
|
||||
@distributors = (1..3).map { create(:distributor_enterprise) }
|
||||
@enterprise_fees = (0..2).map { |i| create(:enterprise_fee, enterprise: @distributors[i]) }
|
||||
@@ -28,7 +28,7 @@ feature '
|
||||
describe "creating a product" do
|
||||
let!(:tax_category) { create(:tax_category, name: 'Test Tax Category') }
|
||||
|
||||
scenario "assigning important attributes", js: true do
|
||||
it "assigning important attributes", js: true do
|
||||
login_to_admin_section
|
||||
|
||||
click_link 'Products'
|
||||
@@ -68,7 +68,7 @@ feature '
|
||||
expect(product.master.options_text).to eq("5kg")
|
||||
end
|
||||
|
||||
scenario "creating an on-demand product", js: true do
|
||||
it "creating an on-demand product", js: true do
|
||||
login_as_admin_and_visit spree.admin_products_path
|
||||
|
||||
click_link 'New Product'
|
||||
@@ -93,7 +93,7 @@ feature '
|
||||
expect(variant.on_demand).to be true
|
||||
end
|
||||
|
||||
scenario "creating product with empty unit value", js: true do
|
||||
it "creating product with empty unit value", js: true do
|
||||
login_as_admin_and_visit spree.admin_products_path
|
||||
|
||||
click_link 'New Product'
|
||||
@@ -167,7 +167,9 @@ feature '
|
||||
}
|
||||
|
||||
context 'products', js: true do
|
||||
before { login_as_admin_and_visit spree.admin_products_path }
|
||||
before do
|
||||
login_as_admin_and_visit spree.admin_products_path
|
||||
end
|
||||
|
||||
it 'creates a copy of the product' do
|
||||
within "#p_#{product1.id}" do
|
||||
@@ -198,7 +200,7 @@ feature '
|
||||
end
|
||||
|
||||
context "products do not require a tax category" do
|
||||
scenario "creating a new product", js: true do
|
||||
it "creating a new product", js: true do
|
||||
with_products_require_tax_category(false) do
|
||||
visit spree.admin_products_path
|
||||
click_link 'New Product'
|
||||
@@ -228,7 +230,7 @@ feature '
|
||||
end
|
||||
end
|
||||
|
||||
scenario "editing a product" do
|
||||
it "editing a product" do
|
||||
product = create(:simple_product, name: 'a product', supplier: @supplier2)
|
||||
|
||||
visit spree.edit_admin_product_path product
|
||||
@@ -242,7 +244,7 @@ feature '
|
||||
expect(product.tax_category).to eq(tax_category)
|
||||
end
|
||||
|
||||
scenario "editing a product comming from the bulk product update page with filter" do
|
||||
it "editing a product comming from the bulk product update page with filter" do
|
||||
product = create(:simple_product, name: 'a product', supplier: @supplier2)
|
||||
|
||||
visit spree.edit_admin_product_path(product, filter)
|
||||
@@ -296,7 +298,7 @@ feature '
|
||||
expect(page).to have_link(I18n.t(:search), href: expected_product_seo_url)
|
||||
end
|
||||
|
||||
scenario "editing product group buy options" do
|
||||
it "editing product group buy options" do
|
||||
product = product = create(:simple_product, supplier: @supplier2)
|
||||
|
||||
visit spree.edit_admin_product_path product
|
||||
@@ -312,7 +314,7 @@ feature '
|
||||
expect(product.group_buy_unit_size).to eq(10.0)
|
||||
end
|
||||
|
||||
scenario "loading editing product group buy options with url filters" do
|
||||
it "loading editing product group buy options with url filters" do
|
||||
product = product = create(:simple_product, supplier: @supplier2)
|
||||
|
||||
visit spree.group_buy_options_admin_product_path(product, filter)
|
||||
@@ -322,7 +324,7 @@ feature '
|
||||
expect(page).to have_link(I18n.t(:cancel), href: expected_cancel_link)
|
||||
end
|
||||
|
||||
scenario "editing product group buy options with url filter" do
|
||||
it "editing product group buy options with url filter" do
|
||||
product = product = create(:simple_product, supplier: @supplier2)
|
||||
|
||||
visit spree.group_buy_options_admin_product_path(product, filter)
|
||||
@@ -335,7 +337,7 @@ feature '
|
||||
expect("#{uri.path}?#{uri.query}").to eq spree.edit_admin_product_path(product, filter)
|
||||
end
|
||||
|
||||
scenario "editing product Search" do
|
||||
it "editing product Search" do
|
||||
product = create(:simple_product, supplier: @supplier2)
|
||||
visit spree.edit_admin_product_path product
|
||||
within('#sidebar') { click_link 'Search' }
|
||||
@@ -348,7 +350,7 @@ feature '
|
||||
expect(product.meta_keywords).to eq('Product Search Keywords')
|
||||
end
|
||||
|
||||
scenario "loading editing product Search with url filters" do
|
||||
it "loading editing product Search with url filters" do
|
||||
product = create(:simple_product, supplier: @supplier2)
|
||||
|
||||
visit spree.seo_admin_product_path(product, filter)
|
||||
@@ -358,7 +360,7 @@ feature '
|
||||
expect(page).to have_link(I18n.t(:cancel), href: expected_cancel_link)
|
||||
end
|
||||
|
||||
scenario "editing product Search with url filter" do
|
||||
it "editing product Search with url filter" do
|
||||
product = create(:simple_product, supplier: @supplier2)
|
||||
|
||||
visit spree.seo_admin_product_path(product, filter)
|
||||
@@ -372,7 +374,7 @@ feature '
|
||||
expect("#{uri.path}?#{uri.query}").to eq spree.edit_admin_product_path(product, filter)
|
||||
end
|
||||
|
||||
scenario "loading product properties page including url filters", js: true do
|
||||
it "loading product properties page including url filters", js: true do
|
||||
product = create(:simple_product, supplier: @supplier2)
|
||||
visit spree.admin_product_product_properties_path(product, filter)
|
||||
|
||||
@@ -387,7 +389,7 @@ feature '
|
||||
expect(page).to have_link(I18n.t(:cancel), href: expected_cancel_link)
|
||||
end
|
||||
|
||||
scenario "deleting product properties", js: true do
|
||||
it "deleting product properties", js: true do
|
||||
# Given a product with a property
|
||||
product = create(:simple_product, supplier: @supplier2)
|
||||
product.set_property('fooprop', 'fooval')
|
||||
@@ -411,7 +413,7 @@ feature '
|
||||
expect(product.reload.property('fooprop')).to be_nil
|
||||
end
|
||||
|
||||
scenario "deleting product properties including url filters", js: true do
|
||||
it "deleting product properties including url filters", js: true do
|
||||
# Given a product with a property
|
||||
product = create(:simple_product, supplier: @supplier2)
|
||||
product.set_property('fooprop', 'fooval')
|
||||
@@ -429,7 +431,7 @@ feature '
|
||||
filter)
|
||||
end
|
||||
|
||||
scenario "adding product properties including url filters", js: true do
|
||||
it "adding product properties including url filters", js: true do
|
||||
# Given a product
|
||||
product = create(:simple_product, supplier: @supplier2)
|
||||
product.set_property('fooprop', 'fooval')
|
||||
@@ -447,7 +449,7 @@ feature '
|
||||
expect("#{uri.path}?#{uri.query}").to eq spree.edit_admin_product_path(product, filter)
|
||||
end
|
||||
|
||||
scenario "loading new product image page", js: true do
|
||||
it "loading new product image page", js: true do
|
||||
product = create(:simple_product, supplier: @supplier2)
|
||||
|
||||
visit spree.admin_product_images_path(product)
|
||||
@@ -457,7 +459,7 @@ feature '
|
||||
expect(page).to have_selector "#image_attachment"
|
||||
end
|
||||
|
||||
scenario "loading new product image page including url filters", js: true do
|
||||
it "loading new product image page including url filters", js: true do
|
||||
product = create(:simple_product, supplier: @supplier2)
|
||||
|
||||
visit spree.admin_product_images_path(product, filter)
|
||||
@@ -473,7 +475,7 @@ feature '
|
||||
expect(page).to have_link(I18n.t(:cancel), href: expected_cancel_link)
|
||||
end
|
||||
|
||||
scenario "upload a new product image including url filters", js: true do
|
||||
it "upload a new product image including url filters", js: true do
|
||||
file_path = Rails.root + "spec/support/fixtures/thinking-cat.jpg"
|
||||
product = create(:simple_product, supplier: @supplier2)
|
||||
|
||||
@@ -488,7 +490,7 @@ feature '
|
||||
expect("#{uri.path}?#{uri.query}").to eq spree.admin_product_images_path(product, filter)
|
||||
end
|
||||
|
||||
scenario "loading image page including url filter", js: true do
|
||||
it "loading image page including url filter", js: true do
|
||||
product = create(:simple_product, supplier: @supplier2)
|
||||
|
||||
visit spree.admin_product_images_path(product, filter)
|
||||
@@ -499,7 +501,7 @@ feature '
|
||||
expect(page).to have_link(I18n.t('spree.new_image'), href: expected_new_image_link)
|
||||
end
|
||||
|
||||
scenario "loading edit product image page including url filter", js: true do
|
||||
it "loading edit product image page including url filter", js: true do
|
||||
product = create(:simple_product, supplier: @supplier2)
|
||||
image = File.open(File.expand_path('../../../app/assets/images/logo-white.png', __dir__))
|
||||
image_object = Spree::Image.create(viewable_id: product.master.id,
|
||||
@@ -519,7 +521,7 @@ feature '
|
||||
expect(page).to have_link("Back To Images List", href: expected_cancel_link)
|
||||
end
|
||||
|
||||
scenario "updating a product image including url filter", js: true do
|
||||
it "updating a product image including url filter", js: true do
|
||||
product = create(:simple_product, supplier: @supplier2)
|
||||
image = File.open(File.expand_path('../../../app/assets/images/logo-white.png', __dir__))
|
||||
image_object = Spree::Image.create(viewable_id: product.master.id,
|
||||
@@ -538,7 +540,7 @@ feature '
|
||||
expect("#{uri.path}?#{uri.query}").to eq spree.admin_product_images_path(product, filter)
|
||||
end
|
||||
|
||||
scenario "deleting product images", js: true do
|
||||
it "deleting product images", js: true do
|
||||
product = create(:simple_product, supplier: @supplier2)
|
||||
image = File.open(File.expand_path('../../../app/assets/images/logo-white.png', __dir__))
|
||||
Spree::Image.create(viewable_id: product.master.id, viewable_type: 'Spree::Variant',
|
||||
@@ -556,7 +558,7 @@ feature '
|
||||
expect(product.reload.images.count).to eq 0
|
||||
end
|
||||
|
||||
scenario "deleting product image including url filter", js: true do
|
||||
it "deleting product image including url filter", js: true do
|
||||
product = create(:simple_product, supplier: @supplier2)
|
||||
image = File.open(File.expand_path('../../../app/assets/images/logo-white.png', __dir__))
|
||||
Spree::Image.create(viewable_id: product.master.id, viewable_type: 'Spree::Variant',
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an admin
|
||||
I want to manage product properties
|
||||
' do
|
||||
include AuthenticationHelper
|
||||
|
||||
scenario "creating and editing a property" do
|
||||
it "creating and editing a property" do
|
||||
login_as_admin_and_visit spree.admin_properties_path
|
||||
|
||||
click_link 'New Property'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
feature "Packing Reports", js: true do
|
||||
describe "Packing Reports", js: true do
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an administrator
|
||||
I want numbers, all the numbers!
|
||||
' do
|
||||
@@ -36,7 +36,7 @@ feature '
|
||||
login_as_admin_and_visit spree.admin_reports_path
|
||||
end
|
||||
|
||||
scenario "customers report" do
|
||||
it "customers report" do
|
||||
click_link "Mailing List"
|
||||
expect(page).to have_select('report_type', selected: 'Mailing List')
|
||||
expect(page).to have_content "click on GO"
|
||||
@@ -49,7 +49,7 @@ feature '
|
||||
].sort)
|
||||
end
|
||||
|
||||
scenario "customers report" do
|
||||
it "customers report" do
|
||||
click_link "Addresses"
|
||||
expect(page).to have_select('report_type', selected: 'Addresses')
|
||||
|
||||
@@ -68,7 +68,7 @@ feature '
|
||||
login_as_admin_and_visit spree.admin_reports_path
|
||||
end
|
||||
|
||||
scenario "payment method report" do
|
||||
it "payment method report" do
|
||||
click_link "Payment Methods Report"
|
||||
click_button "Search"
|
||||
rows = find("table#listing_ocm_orders").all("thead tr")
|
||||
@@ -79,7 +79,7 @@ feature '
|
||||
].sort)
|
||||
end
|
||||
|
||||
scenario "delivery report" do
|
||||
it "delivery report" do
|
||||
click_link "Delivery Report"
|
||||
click_button "Search"
|
||||
rows = find("table#listing_ocm_orders").all("thead tr")
|
||||
@@ -119,7 +119,7 @@ feature '
|
||||
create(:line_item_with_shipment, variant: product_2.master, quantity: 3, order: order2)
|
||||
end
|
||||
|
||||
scenario "Pack By Customer" do
|
||||
it "Pack By Customer" do
|
||||
click_link "Pack By Customer"
|
||||
fill_in 'q_completed_at_gt', with: '2013-04-25 13:00:00'
|
||||
fill_in 'q_completed_at_lt', with: '2013-04-25 16:00:00'
|
||||
@@ -135,7 +135,7 @@ feature '
|
||||
expect(page).to have_selector 'table#listing_orders tbody tr', count: 5 # Totals row per order
|
||||
end
|
||||
|
||||
scenario "Alphabetically Sorted Pack by Customer" do
|
||||
it "Alphabetically Sorted Pack by Customer" do
|
||||
click_link "Pack By Customer"
|
||||
click_button 'Search'
|
||||
|
||||
@@ -151,7 +151,7 @@ feature '
|
||||
])
|
||||
end
|
||||
|
||||
scenario "Pack By Supplier" do
|
||||
it "Pack By Supplier" do
|
||||
click_link "Pack By Supplier"
|
||||
fill_in 'q_completed_at_gt', with: '2013-04-25 13:00:00'
|
||||
fill_in 'q_completed_at_lt', with: '2013-04-25 16:00:00'
|
||||
@@ -168,7 +168,7 @@ feature '
|
||||
end
|
||||
end
|
||||
|
||||
scenario "orders and distributors report" do
|
||||
it "orders and distributors report" do
|
||||
login_as_admin_and_visit spree.admin_reports_path
|
||||
click_link 'Orders And Distributors'
|
||||
click_button 'Search'
|
||||
@@ -176,7 +176,7 @@ feature '
|
||||
expect(page).to have_content 'Order date'
|
||||
end
|
||||
|
||||
scenario "payments reports" do
|
||||
it "payments reports" do
|
||||
login_as_admin_and_visit spree.admin_reports_path
|
||||
click_link 'Payment Reports'
|
||||
click_button 'Search'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'Schedules', js: true do
|
||||
describe 'Schedules', js: true do
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'shipping methods' do
|
||||
describe 'shipping methods' do
|
||||
include WebHelper
|
||||
include AuthenticationHelper
|
||||
|
||||
@@ -15,7 +15,7 @@ feature 'shipping methods' do
|
||||
login_as_admin
|
||||
end
|
||||
|
||||
scenario "creating a shipping method owned by some distributors" do
|
||||
it "creating a shipping method owned by some distributors" do
|
||||
# Given some distributors
|
||||
distributor1 = create(:distributor_enterprise, name: 'Alice Farm Hub')
|
||||
distributor2 = create(:distributor_enterprise, name: 'Bob Farm Shop')
|
||||
@@ -45,14 +45,14 @@ feature 'shipping methods' do
|
||||
expect(sm.distributors).to match_array [distributor1, distributor2]
|
||||
end
|
||||
|
||||
scenario "deleting a shipping method" do
|
||||
it "deleting a shipping method" do
|
||||
visit_delete spree.admin_shipping_method_path(@shipping_method)
|
||||
|
||||
expect(flash_message).to eq "Successfully Removed"
|
||||
expect(Spree::ShippingMethod.where(id: @shipping_method.id)).to be_empty
|
||||
end
|
||||
|
||||
scenario "deleting a shipping method referenced by an order" do
|
||||
it "deleting a shipping method referenced by an order" do
|
||||
order = create(:order)
|
||||
shipment = create(:shipment)
|
||||
shipment.add_shipping_method(@shipping_method, true)
|
||||
@@ -65,14 +65,14 @@ feature 'shipping methods' do
|
||||
expect(Spree::ShippingMethod.find(@shipping_method.id)).not_to be_nil
|
||||
end
|
||||
|
||||
scenario "checking a single distributor is checked by default" do
|
||||
it "checking a single distributor is checked by default" do
|
||||
first_distributor = Enterprise.first
|
||||
visit spree.new_admin_shipping_method_path
|
||||
expect(page).to have_field "shipping_method_distributor_ids_#{first_distributor.id}",
|
||||
checked: true
|
||||
end
|
||||
|
||||
scenario "checking more than a distributor displays no default choice" do
|
||||
it "checking more than a distributor displays no default choice" do
|
||||
distributor1 = create(:distributor_enterprise, name: 'Alice Farm Shop')
|
||||
distributor2 = create(:distributor_enterprise, name: 'Bob Farm Hub')
|
||||
visit spree.new_admin_shipping_method_path
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'Subscriptions' do
|
||||
describe 'Subscriptions' do
|
||||
include AdminHelper
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'Tag Rules', js: true do
|
||||
describe 'Tag Rules', js: true do
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'Account and Billing Settings' do
|
||||
describe 'Account and Billing Settings' do
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an admin
|
||||
I want to check the unit price of my products/variants
|
||||
', js: true do
|
||||
@@ -12,7 +12,7 @@ feature '
|
||||
let!(:stock_location) { create(:stock_location, backorderable_default: false) }
|
||||
|
||||
describe "product" do
|
||||
scenario "creating a new product" do
|
||||
it "creating a new product" do
|
||||
login_as_admin_and_visit spree.admin_products_path
|
||||
click_link 'New Product'
|
||||
select "Weight (kg)", from: 'product_variant_unit_with_scale'
|
||||
@@ -24,7 +24,7 @@ feature '
|
||||
end
|
||||
|
||||
describe "variant" do
|
||||
scenario "creating a new variant" do
|
||||
it "creating a new variant" do
|
||||
product = create(:simple_product, variant_unit: "weight", variant_unit_scale: "1")
|
||||
login_as_admin_and_visit spree.admin_product_variants_path product
|
||||
click_link 'New Variant'
|
||||
@@ -34,7 +34,7 @@ feature '
|
||||
expect(find_field("Unit Price", disabled: true).value).to eq '$1,000.00 / kg'
|
||||
end
|
||||
|
||||
scenario "editing a variant" do
|
||||
it "editing a variant" do
|
||||
product = create(:simple_product, variant_unit: "weight", variant_unit_scale: "1")
|
||||
variant = product.variants.first
|
||||
variant.update(price: 1.0)
|
||||
@@ -45,7 +45,7 @@ feature '
|
||||
end
|
||||
|
||||
describe "when admin use es as default language (and comma as decimal separator)", :debug do
|
||||
scenario "creating a new product with a comma separated decimal price" do
|
||||
it "creating a new product with a comma separated decimal price" do
|
||||
login_as_admin_and_visit spree.admin_dashboard_path(locale: 'es')
|
||||
visit spree.admin_products_path
|
||||
click_link 'Nuevo producto'
|
||||
@@ -56,7 +56,7 @@ feature '
|
||||
expect(find_field("Precio por unidad", disabled: true).value).to eq "1,50 $ / kg"
|
||||
end
|
||||
|
||||
scenario "creating a new variant with a comma separated decimal price" do
|
||||
it "creating a new variant with a comma separated decimal price" do
|
||||
product = create(:simple_product, variant_unit: "weight", variant_unit_scale: "1")
|
||||
login_as_admin_and_visit spree.admin_dashboard_path(locale: 'es')
|
||||
visit spree.admin_product_variants_path product
|
||||
@@ -67,7 +67,7 @@ feature '
|
||||
expect(find_field("Precio por unidad", disabled: true).value).to eq '1.500,00 $ / kg'
|
||||
end
|
||||
|
||||
scenario "editing a variant with a comma separated decimal price" do
|
||||
it "editing a variant with a comma separated decimal price" do
|
||||
product = create(:simple_product, variant_unit: "weight", variant_unit_scale: "1")
|
||||
variant = product.variants.first
|
||||
variant.update(price: 1.5)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
feature "Managing users" do
|
||||
describe "Managing users" do
|
||||
include AuthenticationHelper
|
||||
include OpenFoodNetwork::EmailHelper
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "
|
||||
describe "
|
||||
Managing a hub's inventory
|
||||
I want to override the stock level and price of products
|
||||
Without affecting other hubs that share the same products
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As an admin
|
||||
I want to manage product variants
|
||||
' do
|
||||
@@ -10,7 +10,7 @@ feature '
|
||||
include WebHelper
|
||||
|
||||
describe "new variant", js: true do
|
||||
scenario "creating a new variant" do
|
||||
it "creating a new variant" do
|
||||
# Given a product with a unit-related option type
|
||||
product = create(:simple_product, variant_unit: "weight", variant_unit_scale: "1")
|
||||
|
||||
@@ -26,7 +26,7 @@ feature '
|
||||
expect(page).to have_content "Variant \"#{product.name}\" has been successfully created!"
|
||||
end
|
||||
|
||||
scenario "creating a new variant from product variant page with filter" do
|
||||
it "creating a new variant from product variant page with filter" do
|
||||
# Given a product with a unit-related option type
|
||||
product = create(:simple_product, variant_unit: "weight", variant_unit_scale: "1")
|
||||
filter = { producerFilter: 2 }
|
||||
@@ -48,7 +48,7 @@ feature '
|
||||
end
|
||||
|
||||
describe "viewing product variant" do
|
||||
scenario "when the product page has a product filter" do
|
||||
it "when the product page has a product filter" do
|
||||
# Given a product with a unit-related option type
|
||||
product = create(:simple_product, variant_unit: "weight", variant_unit_scale: "1")
|
||||
filter = { producerFilter: 2 }
|
||||
@@ -84,7 +84,7 @@ feature '
|
||||
end
|
||||
|
||||
describe "editing unit value and description for a variant", js: true do
|
||||
scenario "when the product variant page has product filter" do
|
||||
it "when the product variant page has product filter" do
|
||||
product = create(:simple_product, variant_unit: "weight", variant_unit_scale: "1")
|
||||
filter = { producerFilter: 2 }
|
||||
|
||||
@@ -99,7 +99,7 @@ feature '
|
||||
expect(page).to have_link(I18n.t('actions.cancel'), href: expected_cancel_url)
|
||||
end
|
||||
|
||||
scenario "when variant_unit is weight" do
|
||||
it "when variant_unit is weight" do
|
||||
# Given a product with unit-related option types, with a variant
|
||||
product = create(:simple_product, variant_unit: "weight", variant_unit_scale: "1")
|
||||
variant = product.variants.first
|
||||
@@ -130,7 +130,7 @@ feature '
|
||||
expect(variant.unit_description).to eq('bar')
|
||||
end
|
||||
|
||||
scenario "can update unit_description when variant_unit is items" do
|
||||
it "can update unit_description when variant_unit is items" do
|
||||
product = create(:simple_product, variant_unit: "items", variant_unit_name: "bunches")
|
||||
variant = product.variants.first
|
||||
variant.update(unit_description: 'foo')
|
||||
@@ -204,7 +204,7 @@ feature '
|
||||
expect(variant.reload.deleted_at).not_to be_nil
|
||||
end
|
||||
|
||||
scenario "editing display name for a variant", js: true do
|
||||
it "editing display name for a variant", js: true do
|
||||
product = create(:simple_product)
|
||||
variant = product.variants.first
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "Credit Cards", js: true do
|
||||
describe "Credit Cards", js: true do
|
||||
include AuthenticationHelper
|
||||
include StripeHelper
|
||||
include StripeStubs
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "Payments requiring action", js: true do
|
||||
describe "Payments requiring action", js: true do
|
||||
include AuthenticationHelper
|
||||
|
||||
describe "as a logged in user" do
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "Account Settings", js: true do
|
||||
describe "Account Settings", js: true do
|
||||
include AuthenticationHelper
|
||||
include OpenFoodNetwork::EmailHelper
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As a consumer
|
||||
I want to view my order history with each hub
|
||||
and view any outstanding balance.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "Authentication", js: true do
|
||||
describe "Authentication", js: true do
|
||||
include AuthenticationHelper
|
||||
include UIComponentHelper
|
||||
include OpenFoodNetwork::EmailHelper
|
||||
@@ -11,7 +11,7 @@ feature "Authentication", js: true do
|
||||
let(:user) { create(:user, password: "password", password_confirmation: "password") }
|
||||
|
||||
describe "With redirects" do
|
||||
scenario "logging in with a redirect set" do
|
||||
it "logging in with a redirect set" do
|
||||
visit groups_path(anchor: "login?after_login=#{producers_path}")
|
||||
fill_in "Email", with: user.email
|
||||
fill_in "Password", with: user.password
|
||||
@@ -31,17 +31,17 @@ feature "Authentication", js: true do
|
||||
open_login_modal
|
||||
end
|
||||
|
||||
scenario "showing login" do
|
||||
it "showing login" do
|
||||
expect(page).to have_login_modal
|
||||
end
|
||||
|
||||
scenario "failing to login" do
|
||||
it "failing to login" do
|
||||
fill_in "Email", with: user.email
|
||||
click_login_button
|
||||
expect(page).to have_content "Invalid email or password"
|
||||
end
|
||||
|
||||
scenario "logging in successfully" do
|
||||
it "logging in successfully" do
|
||||
fill_in "Email", with: user.email
|
||||
fill_in "Password", with: user.password
|
||||
click_login_button
|
||||
@@ -53,28 +53,28 @@ feature "Authentication", js: true do
|
||||
select_login_tab "Sign up"
|
||||
end
|
||||
|
||||
scenario "Failing to sign up because password is too short" do
|
||||
it "Failing to sign up because password is too short" do
|
||||
fill_in "Email", with: "test@foo.com"
|
||||
fill_in "Choose a password", with: "short"
|
||||
click_signup_button
|
||||
expect(page).to have_content "too short"
|
||||
end
|
||||
|
||||
scenario "Failing to sign up because email is already registered" do
|
||||
it "Failing to sign up because email is already registered" do
|
||||
fill_in "Email", with: user.email
|
||||
fill_in "Choose a password", with: "foobarino"
|
||||
click_signup_button
|
||||
expect(page).to have_content "There's already an account for this email."
|
||||
end
|
||||
|
||||
scenario "Failing to sign up because password confirmation doesn't match or is blank" do
|
||||
it "Failing to sign up because password confirmation doesn't match or is blank" do
|
||||
fill_in "Email", with: user.email
|
||||
fill_in "Choose a password", with: "ForgotToRetype"
|
||||
click_signup_button
|
||||
expect(page).to have_content "doesn't match"
|
||||
end
|
||||
|
||||
scenario "Signing up successfully" do
|
||||
it "Signing up successfully" do
|
||||
performing_deliveries do
|
||||
setup_email
|
||||
fill_in "Email", with: "test@foo.com"
|
||||
@@ -95,13 +95,13 @@ feature "Authentication", js: true do
|
||||
select_login_tab "Forgot Password?"
|
||||
end
|
||||
|
||||
scenario "failing to reset password" do
|
||||
it "failing to reset password" do
|
||||
fill_in "Your email", with: "notanemail@myemail.com"
|
||||
click_reset_password_button
|
||||
expect(page).to have_content "Email address not found"
|
||||
end
|
||||
|
||||
scenario "resetting password" do
|
||||
it "resetting password" do
|
||||
fill_in "Your email", with: user.email
|
||||
expect do
|
||||
click_reset_password_button
|
||||
@@ -117,7 +117,7 @@ feature "Authentication", js: true do
|
||||
Spree::User.create(email: email, unconfirmed_email: email, password: "secret")
|
||||
}
|
||||
|
||||
scenario "cannot reset password before confirming email" do
|
||||
it "cannot reset password before confirming email" do
|
||||
fill_in "Your email", with: email
|
||||
click_reset_password_button
|
||||
expect(page).to have_content I18n.t('email_unconfirmed')
|
||||
@@ -144,7 +144,7 @@ feature "Authentication", js: true do
|
||||
after do
|
||||
browse_as_large
|
||||
end
|
||||
scenario "showing login" do
|
||||
it "showing login" do
|
||||
open_off_canvas
|
||||
open_login_modal
|
||||
expect(page).to have_login_modal
|
||||
@@ -153,14 +153,14 @@ feature "Authentication", js: true do
|
||||
end
|
||||
|
||||
describe "after following email confirmation link" do
|
||||
scenario "shows confirmed message in modal" do
|
||||
it "shows confirmed message in modal" do
|
||||
visit '/#/login?validation=confirmed'
|
||||
expect(page).to have_login_modal
|
||||
expect(page).to have_content I18n.t('devise.confirmations.confirmed')
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Loggin by typing login/ redirects to /#/login" do
|
||||
it "Loggin by typing login/ redirects to /#/login" do
|
||||
visit "/login"
|
||||
uri = URI.parse(current_url)
|
||||
expect(uri.path + "#" + uri.fragment).to eq('/#/login')
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
feature "Darkswarm data caching", js: true, caching: true do
|
||||
describe "Darkswarm data caching", js: true, caching: true do
|
||||
let!(:taxon) { create(:taxon, name: "Cached Taxon") }
|
||||
let!(:property) { create(:property, presentation: "Cached Property") }
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
feature "Shops caching", js: true, caching: true do
|
||||
describe "Shops caching", js: true, caching: true do
|
||||
include WebHelper
|
||||
include UIComponentHelper
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "Footer Links", js: true do
|
||||
describe "Footer Links", js: true do
|
||||
describe "policy link" do
|
||||
scenario "showing" do
|
||||
it "showing" do
|
||||
visit root_path
|
||||
expect(page).to have_link "cookies policy"
|
||||
end
|
||||
|
||||
scenario "opens cookies policy page" do
|
||||
it "opens cookies policy page" do
|
||||
visit root_path
|
||||
click_link "cookies policy"
|
||||
expect(page).to have_content I18n.t('legal.cookies_policy.header')
|
||||
@@ -17,13 +17,13 @@ feature "Footer Links", js: true do
|
||||
end
|
||||
|
||||
describe "privacy policy link" do
|
||||
scenario "not showing if it is empty" do
|
||||
it "not showing if it is empty" do
|
||||
Spree::Config[:privacy_policy_url] = nil
|
||||
visit root_path
|
||||
expect(page).to have_no_link "privacy policy"
|
||||
end
|
||||
|
||||
scenario "showing configured privacy policy link" do
|
||||
it "showing configured privacy policy link" do
|
||||
Spree::Config[:privacy_policy_url] = "link_to_privacy_policy"
|
||||
visit root_path
|
||||
expect(page).to have_link "privacy policy", href: "link_to_privacy_policy"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'Groups', js: true do
|
||||
describe 'Groups', js: true do
|
||||
include AuthenticationHelper
|
||||
include UIComponentHelper
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'Multilingual', js: true do
|
||||
describe 'Multilingual', js: true do
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
include ShopWorkflow
|
||||
@@ -22,7 +22,7 @@ feature 'Multilingual', js: true do
|
||||
end
|
||||
|
||||
context 'can switch language by params' do
|
||||
scenario 'in root path' do
|
||||
it 'in root path' do
|
||||
visit root_path
|
||||
expect(get_i18n_locale).to eq 'en'
|
||||
expect(get_i18n_translation('label_shops')).to eq 'Shops'
|
||||
@@ -54,14 +54,14 @@ feature 'Multilingual', js: true do
|
||||
add_product_to_cart order, product, quantity: 1
|
||||
end
|
||||
|
||||
scenario "in the cart page" do
|
||||
it "in the cart page" do
|
||||
visit main_app.cart_path(locale: 'es')
|
||||
|
||||
expect_menu_and_cookie_in_es
|
||||
expect(page).to have_content 'Precio'
|
||||
end
|
||||
|
||||
scenario "in the checkout page" do
|
||||
it "in the checkout page" do
|
||||
visit checkout_path(locale: 'es')
|
||||
|
||||
expect_menu_and_cookie_in_es
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature '
|
||||
describe '
|
||||
As a consumer
|
||||
I want to see a list of producers
|
||||
So that I can shop at hubs distributing their products
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "Registration", js: true do
|
||||
describe "Registration", js: true do
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "full-page cart", js: true do
|
||||
describe "full-page cart", js: true do
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
include ShopWorkflow
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "As a consumer I want to check out my cart", js: true do
|
||||
describe "As a consumer I want to check out my cart", js: true do
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
include ShopWorkflow
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
feature "Check out with Paypal", js: true do
|
||||
describe "Check out with Paypal", js: true do
|
||||
include ShopWorkflow
|
||||
include CheckoutRequestsHelper
|
||||
include AuthenticationHelper
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "As a consumer I want to check out my cart", js: true do
|
||||
describe "As a consumer I want to check out my cart", js: true do
|
||||
include AuthenticationHelper
|
||||
include ShopWorkflow
|
||||
include CheckoutRequestsHelper
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "Check out with Stripe", js: true do
|
||||
describe "Check out with Stripe", js: true do
|
||||
include AuthenticationHelper
|
||||
include ShopWorkflow
|
||||
include CheckoutRequestsHelper
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "Using embedded shopfront functionality", js: true do
|
||||
describe "Using embedded shopfront functionality", js: true do
|
||||
include OpenFoodNetwork::EmbeddedPagesHelper
|
||||
|
||||
describe 'embedded groups' do
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "Using embedded shopfront functionality", js: true do
|
||||
describe "Using embedded shopfront functionality", js: true do
|
||||
include OpenFoodNetwork::EmbeddedPagesHelper
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "Order Management", js: true do
|
||||
describe "Order Management", js: true do
|
||||
include AuthenticationHelper
|
||||
include OpenFoodNetwork::EmailHelper
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "As a consumer I want to view products", js: true do
|
||||
describe "As a consumer I want to view products", js: true do
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
include ShopWorkflow
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "As a consumer I want to shop with a distributor", js: true do
|
||||
describe "As a consumer I want to shop with a distributor", js: true do
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
include ShopWorkflow
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "As a consumer, I want to check unit price information for a product", js: true do
|
||||
describe "As a consumer, I want to check unit price information for a product", js: true do
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
include ShopWorkflow
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature "shopping with variant overrides defined", js: true do
|
||||
describe "shopping with variant overrides defined", js: true do
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
include ShopWorkflow
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'Shops', js: true do
|
||||
describe 'Shops', js: true do
|
||||
include AuthenticationHelper
|
||||
include UIComponentHelper
|
||||
include WebHelper
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'sitemap' do
|
||||
describe 'sitemap' do
|
||||
let(:enterprise) { create(:distributor_enterprise) }
|
||||
let!(:group) { create(:enterprise_group, enterprises: [enterprise], on_front_page: true) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user