Sha256: da497f669806422bd9520563947db0b800c27b6c9401e3e40aa37468395b12b3

Contents?: true

Size: 1.22 KB

Versions: 14

Compression:

Stored size: 1.22 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, '01-2-3-4-5')
      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('page 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

14 entries across 14 versions & 1 rubygems

Version Path
adminpanel-2.3.1 test/models/adminpanel/section_test.rb
adminpanel-2.3.0 test/models/adminpanel/section_test.rb
adminpanel-2.2.5 test/models/adminpanel/section_test.rb
adminpanel-2.2.4 test/models/adminpanel/section_test.rb
adminpanel-2.2.3 test/models/adminpanel/section_test.rb
adminpanel-2.2.2 test/models/adminpanel/section_test.rb
adminpanel-2.2.1 test/models/adminpanel/section_test.rb
adminpanel-2.2.0 test/models/adminpanel/section_test.rb
adminpanel-2.1.7 test/models/adminpanel/section_test.rb
adminpanel-2.1.6 test/models/adminpanel/section_test.rb
adminpanel-2.1.5 test/models/adminpanel/section_test.rb
adminpanel-2.1.3 test/models/adminpanel/section_test.rb
adminpanel-2.1.2 test/models/adminpanel/section_test.rb
adminpanel-2.1.1 test/models/adminpanel/section_test.rb