Sha256: 0861718d71336c0d32fe23a8e963b4cc6a34bf5175a5efc77e9c4fefdce45a81

Contents?: true

Size: 655 Bytes

Versions: 5

Compression:

Stored size: 655 Bytes

Contents

require 'spec_helper'

describe Spree::Address do
  let(:address) {build(:address)}

  it { is_expected.to validate_presence_of(:number) }
  it { is_expected.to validate_presence_of(:district) }

  it 'should validate length of district' do
    address.district = string_with_length(151)

    expect(address).to_not be_valid
  end

  it 'should validate number negative' do
    address.number = -1

    expect(address).to_not be_valid
  end

  context '#save' do
    subject { address }

    before { address.save! }

    it { is_expected.to be_persisted }
  end

  def string_with_length(length)
    (1..length).map { (65 + rand(26)).chr }.join
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
solidus_br_common-1.1.2 spec/models/spree/address_spec.rb
solidus_br_common-1.1.1 spec/models/spree/address_spec.rb
solidus_br_common-1.1.0 spec/models/spree/address_spec.rb
spree_br_common-3.0.1 spec/models/spree/address_spec.rb
spree_br_common-3.0.0 spec/models/spree/address_spec.rb