mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
Spec current behaviour of country selector
The enterprise sign-up form shows invalid countries without states and does not choose the default country. See: https://github.com/openfoodfoundation/openfoodnetwork/issues/1330
This commit is contained in:
@@ -6,7 +6,20 @@ feature "Registration", js: true do
|
||||
|
||||
describe "Registering a Profile" do
|
||||
let(:user) { create(:user, password: "password", password_confirmation: "password") }
|
||||
before { Spree::Config.enterprises_require_tos = false }
|
||||
|
||||
before do
|
||||
Spree::Config.enterprises_require_tos = false
|
||||
|
||||
albania = Spree::Country.create!({ name: "Albania", iso3: "ALB", iso: "AL", iso_name: "ALBANIA", numcode: "8" }, without_protection: true)
|
||||
Spree::State.create!({ name: "Berat", abbr: "BRA", country: albania }, without_protection: true)
|
||||
Spree::Country.create!({ name: "Chad", iso3: "TCD", iso: "TD", iso_name: "CHAD", numcode: "148" }, without_protection: true)
|
||||
end
|
||||
|
||||
after do
|
||||
Spree::State.where(name: 'Berat').delete_all
|
||||
Spree::Country.where(name: 'Albania').delete_all
|
||||
Spree::Country.where(name: 'Chad').delete_all
|
||||
end
|
||||
|
||||
it "Allows a logged in user to register a profile" do
|
||||
visit registration_path
|
||||
@@ -35,6 +48,7 @@ feature "Registration", js: true do
|
||||
fill_in 'enterprise_address', with: '123 Abc Street'
|
||||
fill_in 'enterprise_city', with: 'Northcote'
|
||||
fill_in 'enterprise_zipcode', with: '3070'
|
||||
expect(page).to have_select('enterprise_country', options: %w(Albania Australia Chad), selected: 'Albania')
|
||||
select 'Australia', from: 'enterprise_country'
|
||||
select 'VIC', from: 'enterprise_state'
|
||||
perform_and_ensure(:click_button, "Continue", lambda { page.has_content? 'Who is responsible for managing My Awesome Enterprise?' })
|
||||
|
||||
Reference in New Issue
Block a user