Sha256: 7038d93b863561b947b1d938945315fd09fdd8664c6f39506246c9282318ba93

Contents?: true

Size: 1.34 KB

Versions: 97

Compression:

Stored size: 1.34 KB

Contents

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

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

  def setup
    @p = Goldberg::Permission.find :first
  end
  
  def test_invalid_without_name
    site_controller = Goldberg::SiteController.new
    assert(!site_controller.valid?)
    assert(site_controller.errors.invalid?(:name))
    assert(!site_controller.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

    site_controller_1 = Goldberg::SiteController.new
    site_controller_1.permission = @p
    site_controller_2 = Goldberg::SiteController.new
    site_controller_2.permission = @p

    site_controller_1.name = name_1
    site_controller_2.name = name_2

    assert(site_controller_1.save)
    assert(site_controller_2.save)

    site_controller_2.name = name_1

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

  
  #create so the classes method can be tested...
  class ThereShouldBeNoSuchRealClassNameGoldbergTestController < ApplicationController
  end
  
    
  def test_classes_finds_direct_controller_derivatives
    classes = Goldberg::SiteController.classes
    assert(classes.has_value?(SiteControllerTest::ThereShouldBeNoSuchRealClassNameGoldbergTestController))
  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/site_controller_test.rb
six-updater-web-0.24.14 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.24.13 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.24.12 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.24.11 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.24.10 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.24.9 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.24.8 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.24.7 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.24.6 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.24.5 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.24.4 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.24.3 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.24.2 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.24.1 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.24.0 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.23.7 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.23.6 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.23.5 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb
six-updater-web-0.23.4 lib/six-updater-web/vendor/plugins/goldberg/test/unit/site_controller_test.rb