Sha256: ab791d16b67f89b2edf5ae3a2401c66cf6e14a14acf6235fd5682d1d2753c36f

Contents?: true

Size: 1.13 KB

Versions: 15

Compression:

Stored size: 1.13 KB

Contents

require 'test_helper'

module Adminpanel
  class SectionTest < ActiveSupport::TestCase

    def test_telephone_validations
      set_telephone
      assert @telephone.valid?

      @telephone.update_attribute(:description, '1' * 9)
      assert @telephone.invalid?

      @telephone.update_attribute(:description, '1' * 11)
      assert @telephone.invalid?

      @telephone.update_attribute(:description, '')
      assert @telephone.valid?
    end

    def test_default_scope
      assert_equal(
        Adminpanel::Section.all.to_sql,
        Adminpanel::Section.reorder('').order(:order => :asc).to_sql
      )
    end

  protected
    def set_telephone
      @telephone = Adminpanel::Section.new(
        name: 'Telefono',
        key: 'phone',
        has_description: false,
        description: '1234567890',
        page: 'home',
        has_image: false
      )
    end

    def set_description
      @description = Adminpanel::Section.new(
        name: 'Inicio',
        key: 'greeting',
        has_description: true,
        description: 'lorem ipsum dolor sit amec',
        page: 'home',
        has_image: false
      )
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
adminpanel-3.6.1 test/models/adminpanel/section_test.rb
adminpanel-3.6.0 test/models/adminpanel/section_test.rb
adminpanel-3.5.1 test/models/adminpanel/section_test.rb
adminpanel-3.5.0 test/models/adminpanel/section_test.rb
adminpanel-3.4.7 test/models/adminpanel/section_test.rb
adminpanel-3.4.6 test/models/adminpanel/section_test.rb
adminpanel-3.4.5 test/models/adminpanel/section_test.rb
adminpanel-3.4.4 test/models/adminpanel/section_test.rb
adminpanel-3.4.3 test/models/adminpanel/section_test.rb
adminpanel-3.4.2 test/models/adminpanel/section_test.rb
adminpanel-3.4.1 test/models/adminpanel/section_test.rb
adminpanel-3.4.0 test/models/adminpanel/section_test.rb
adminpanel-3.3.4 test/models/adminpanel/section_test.rb
adminpanel-3.3.3 test/models/adminpanel/section_test.rb
adminpanel-3.3.0 test/models/adminpanel/section_test.rb