Sha256: 1677832cf1e45795d59b7390d42df01cc170930a48e0eb60647b06ea6c2a44e3

Contents?: true

Size: 778 Bytes

Versions: 97

Compression:

Stored size: 778 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'

class PermissionTest < Test::Unit::TestCase
  include Goldberg::TestHelper

  def test_invalid_without_name
    permission = Goldberg::Permission.new
    assert(!permission.valid?)
    assert(permission.errors.invalid?(:name))
    assert(!permission.save)
  end


  def test_uniqueness_of_name
    name_1 = 'THIS_IS_NAME_1'
    name_2 = 'THIS_IS_NAME_2'
    name_1.freeze
    name_2.freeze

    permission_1 = Goldberg::Permission.new
    permission_2 = Goldberg::Permission.new

    permission_1.name = name_1
    permission_2.name = name_2

    assert(permission_1.save)
    assert(permission_2.save)

    permission_2.name = name_1

    assert(!permission_2.save)
    assert(permission_2.errors.invalid?(:name))
  end

end

Version data entries

97 entries across 97 versions & 2 rubygems

Version Path
six-updater-web-0.24.15 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.24.14 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.24.13 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.24.12 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.24.11 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.24.10 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.24.9 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.24.8 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.24.7 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.24.6 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.24.5 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.24.4 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.24.3 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.24.2 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.24.1 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.24.0 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.23.7 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.23.6 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.23.5 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb
six-updater-web-0.23.4 lib/six-updater-web/vendor/plugins/goldberg/test/unit/permission_test.rb