Sha256: 6cca4f408e3a378c2128b34f9c09c5baf978194a7b8faee901bf1fdfff536713

Contents?: true

Size: 850 Bytes

Versions: 10

Compression:

Stored size: 850 Bytes

Contents

require "test/test_helper"

class ValidationTest < ActiveSupport::TestCase

  context "A model that has and validates its role" do

    setup do 
      @user = User.new()
    end
    
    context "that has a role_name mapping to a role" do
      
      setup do
        @user.role_name = "admin"
      end
      
      should "be valid" do
        assert @user.valid?
      end
      
    end
    
    context "that has a blank role_name" do
      
      setup do
        @user.role_name = ""
      end
      
      should "not be valid" do
        assert !@user.valid?
      end
      
    end
    
    context "that has a role_name not mapping to a role" do
      
      setup do
        @user.role_name = "nonexisting_role_name"
      end
      
      should "not be valid" do
        assert !@user.valid?
      end
      
    end
    
  end

end

Version data entries

10 entries across 10 versions & 4 rubygems

Version Path
cjbottaro-aegis-1.3.0 test/validation_test.rb
cjbottaro-aegis-1.3.1 test/validation_test.rb
makandra-aegis-1.1.1 test/validation_test.rb
makandra-aegis-1.1.2 test/validation_test.rb
bmaland-aegis-1.1.6 test/validation_test.rb
aegis-1.1.6 test/validation_test.rb
aegis-1.1.5 test/validation_test.rb
bmaland-aegis-1.1.5 test/validation_test.rb
aegis-1.1.4 test/validation_test.rb
aegis-1.1.3 test/validation_test.rb