Sha256: d163558859904ad4d2b85f9d6409a7b8d045b058e57f03ecce04880c0c6d3352

Contents?: true

Size: 631 Bytes

Versions: 1

Compression:

Stored size: 631 Bytes

Contents

require 'spec_helper'

describe City do
  it { is_expected.to be_a_kind_of InscriptioCursualis::City }

  it { is_expected.to belong_to(:state) }

  it { is_expected.to have_many(:districts).dependent(:restrict_with_exception) }
  it { is_expected.to have_many(:neighborhoods).dependent(:restrict_with_exception) }
  it { is_expected.to have_many(:streets).dependent(:restrict_with_exception) }

  it { is_expected.to validate_presence_of :name }
  it { is_expected.to validate_presence_of :state }

  it 'cast to string using name' do
    subject.name = 'Belo Horizonte'

    expect(subject.to_s).to eq 'Belo Horizonte'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unico-training-7.8.0 spec/models/city_spec.rb