Sha256: d6162d540c11ac0478d1be1d6502c477e5bded6d4ac00a7ae5e47faf8d60e4d6
Contents?: true
Size: 1.83 KB
Versions: 6
Compression:
Stored size: 1.83 KB
Contents
require 'spec_helper' describe "States", type: :feature do stub_authorization! let!(:country) { create(:country) } let!(:hungary) do Spree::Country.create!(name: "Hungary", iso_name: "Hungary") end def go_to_states_page visit spree.admin_country_states_path(country) expect(page).to have_css("#new_state_link") end context "admin visiting states listing" do let!(:state) { create(:state, country: country) } it "should correctly display the states" do visit spree.admin_country_states_path(country) expect(page).to have_content(state.name) end end context "creating and editing states" do it "should allow an admin to edit existing states", js: true do go_to_states_page select country.name, from: 'Country' click_link "new_state_link" fill_in "state_name", with: "Calgary" fill_in "Abbreviation", with: "CL" click_button "Create" expect(page).to have_content("successfully created!") expect(page).to have_content("Calgary") end it "should allow an admin to create states for non default countries", js: true do go_to_states_page select "Hungary", from: 'Country' click_link "new_state_link" fill_in "state_name", with: "Pest megye" fill_in "Abbreviation", with: "PE" click_button "Create" expect(page).to have_content("successfully created!") expect(page).to have_content("Pest megye") expect(page).to have_select('Country', selected: "Hungary") end it "should show validation errors", js: true do go_to_states_page select country.name, from: 'Country' click_link "new_state_link" fill_in "state_name", with: "" fill_in "Abbreviation", with: "" click_button "Create" expect(page).to have_content("Name can't be blank") end end end
Version data entries
6 entries across 6 versions & 1 rubygems