Sha256: 895bae4df9ba2727e4858d5c2c2cdc339a277382f208e0a26aa4d6fd3d40bb30

Contents?: true

Size: 968 Bytes

Versions: 4

Compression:

Stored size: 968 Bytes

Contents

require File.join(File.dirname(__FILE__), 'test_helper.rb')

module Alias
  class CreatorTest < Test::Unit::TestCase
    context "invalid creator" do
      before(:all) { eval "class Alias::TestCreator < Alias::Creator; end"}
      test "raises AbstractMethodError if map not defined" do
        assert_raises(Creator::AbstractMethodError) {
          TestCreator.maps_config({})
        }
      end

      test "raises AbstractMethodError if generate not defined" do
        assert_raises(Creator::AbstractMethodError) {
          TestCreator.generates_aliases([])
        }
      end

      test "raises ArgumentError when no validator is given" do
        assert_raises(ArgumentError) { TestCreator.valid :name }
      end

      test "prints error and deletes validator when invalid one is given" do
        capture_stderr { TestCreator.valid(:name, :if=>:blah) }.should =~ /not set/
        TestCreator.validators[:name].should == nil
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
cldwalker-alias-0.2.0 test/creator_test.rb
cldwalker-alias-0.2.1 test/creator_test.rb
alias-0.2.0 test/creator_test.rb
alias-0.2.1 test/creator_test.rb