Sha256: a61baf323b6664953e6fbf6d01d2c26518cd94512cb2c9598b1d374ea8182d9b
Contents?: true
Size: 1.75 KB
Versions: 1
Compression:
Stored size: 1.75 KB
Contents
require_relative "../test_helper" class CmsPageTest < ActiveSupport::TestCase setup do @site = comfy_cms_sites(:default) @page = comfy_cms_pages(:default) @translation = comfy_cms_translations(:default) end def test_fixtures_validity Comfy::Cms::Translation.all.each do |translation| assert translation.valid?, translation.errors.full_messages.to_s end end def test_validations translation = Comfy::Cms::Translation.new translation.save assert translation.invalid? assert_has_errors_on translation, :page, :layout, :locale, :label end def test_validation_on_locale_uniqueness translation = @page.translations.new( label: "Test", locale: @translation.locale ) assert translation.invalid? assert_has_errors_on translation, :locale end def test_validation_on_locale_uniqueness_against_site translation = @page.translations.new( label: "Test", locale: @site.locale ) assert translation.invalid? assert_has_errors_on translation, :locale end def test_creation assert_count_difference [Comfy::Cms::Translation, Comfy::Cms::Fragment] do translation = @page.translations.create( locale: "test", label: "Test Translation", fragments_attributes: [ { identifier: "content", tag: "text", content: "test" } ] ) assert_equal @page.layout, translation.layout end end def test_scope_published assert_equal 1, Comfy::Cms::Translation.published.count @translation.update_columns(is_published: false) assert_equal 0, Comfy::Cms::Translation.published.count end def test_site_delegation assert_equal @site, @translation.site end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
comfortable_mexican_sofa-2.0.9 | test/models/translation_test.rb |