Sha256: 0fc330cbfd99ffe3c602e9dbbf5321273a7f00f38e4b09e97ecc4aa26d03ec73
Contents?: true
Size: 988 Bytes
Versions: 7
Compression:
Stored size: 988 Bytes
Contents
require 'spec_helper' RSpec.describe SolidusPaypalCommercePlatform::StateGuesser, type: :model do let(:country) { create(:country, iso: "IT") } let!(:state) { create(:state, country: country, name: "Abruzzo") } describe "#guess" do context "with a guessable state error" do it "correctly guesses the state" do expect( described_class.new("Pescara", country).guess ).to eq state end it "guesses the state using an abbreviation" do expect( described_class.new("PE", country).guess ).to eq state end end context "with an unsolvable state error" do it "returns nil" do expect( described_class.new("Gondor", country).guess ).to eq nil end end context "with an already correct state" do it "returns the correct state" do expect( described_class.new("Abruzzo", country).guess ).to eq state end end end end
Version data entries
7 entries across 7 versions & 1 rubygems