So now we test in depth at the model level, and can be a bit more relaxed about integration tests for translations. Note we're defining some extra factories to make sure all translatable attributes with presence validation rules are mandatory. This way we can simplify the way we obtain required fields, using `required_attribute?`. Otherwise, fields having an `unless` condition in their presence validation rules would count as mandatory even when they're not.
17 lines
416 B
Ruby
17 lines
416 B
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe SiteCustomization::Page, type: :model do
|
|
let(:custom_page) { build(:site_customization_page) }
|
|
|
|
it_behaves_like "globalizable", :site_customization_page
|
|
|
|
it "is valid" do
|
|
expect(custom_page).to be_valid
|
|
end
|
|
|
|
it "is invalid if slug has symbols" do
|
|
custom_page = build(:site_customization_page, slug: "as/as*la")
|
|
expect(custom_page).to be_invalid
|
|
end
|
|
end
|