wedding-planner/spec/models/wedding_spec.rb

28 lines
888 B
Ruby
Raw Normal View History

2024-12-28 16:31:27 +00:00
# Copyright (C) 2024 Manuel Bustillo
2024-11-30 18:31:48 +00:00
# Copyright (C) 2024 Manuel Bustillo
# frozen_string_literal: true
2024-11-30 19:24:59 +01:00
require 'rails_helper'
2024-12-28 17:27:28 +01:00
RSpec.describe Wedding do
describe 'validations' do
subject { build(:wedding) }
2024-12-28 17:27:28 +01:00
describe 'slug' do
2024-12-28 17:27:28 +01:00
it { is_expected.to allow_value('foo').for(:slug) }
it { is_expected.to allow_value('foo-bar').for(:slug) }
it { is_expected.to allow_value('foo-123').for(:slug) }
it { is_expected.to allow_value('foo-123-').for(:slug) }
it { is_expected.to allow_value('foo--123').for(:slug) }
2024-12-28 17:27:28 +01:00
it { is_expected.not_to allow_value('Foo').for(:slug) }
it { is_expected.not_to allow_value('/foo').for(:slug) }
it { is_expected.not_to allow_value('foo/123').for(:slug) }
it { is_expected.not_to allow_value('foo_123').for(:slug) }
it { is_expected.not_to allow_value('foo/').for(:slug) }
end
end
2024-11-30 19:24:59 +01:00
end