You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
541 B
20 lines
541 B
require 'rails_helper'
|
|
|
|
RSpec.describe District, type: :model do
|
|
let(:district1) { District.create(name: 'District one', state_id: 32) }
|
|
let(:district2) { District.new(name: 'District two', state_id: 32) }
|
|
|
|
context "when saving or creating" do
|
|
it 'should return a slug' do
|
|
expect(district1.slug).to eq 'district-one'
|
|
|
|
district2.save
|
|
expect(district2.slug).to eq 'district-two'
|
|
|
|
first_district = District.find_by_slug('district-one')
|
|
expect(first_district.slug).to eq 'district-one'
|
|
end
|
|
end
|
|
end
|
|
|