Sha256: 58f2b253782f8394b652fb2112f9640dca01d7fe3475c7591de41414cf7c6f08

Contents?: true

Size: 809 Bytes

Versions: 2

Compression:

Stored size: 809 Bytes

Contents

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

describe "invalid creator" do
  before_all { eval "class Alias::TestCreator < Alias::Creator; end"}
  it "raises AbstractMethodError if map not defined" do
    should.raise(Creator::AbstractMethodError) {
      TestCreator.maps_config({})
    }
  end

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

  it "raises ArgumentError when no validator is given" do
    should.raise(ArgumentError) { TestCreator.valid :name }
  end

  it "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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alias-0.2.3 test/creator_test.rb
alias-0.2.2 test/creator_test.rb