Sha256: b0225e593e400f79e465e35c595c1683a376c9b01f90a3e58404e5faa2a00467

Contents?: true

Size: 791 Bytes

Versions: 5

Compression:

Stored size: 791 Bytes

Contents

require File.join( File.dirname(__FILE__), "spec_helper" )

describe DslAccessor do
  it "should duplicate blank array automatically" do
    k1 = Class.new

    array = []
    k1.dsl_accessor :foo, array

    k1.foo.should == array
    k1.foo.should_not equal(array)
  end

  it "should duplicate blank hash automatically" do
    k1 = Class.new

    hash = {}
    k1.dsl_accessor :foo, :default=>hash

    k1.foo.should == hash
    k1.foo.should_not equal(hash)
  end

  it "should call the method when symbol given" do
    k1 = Class.new
    def k1.construct
      1
    end
    k1.dsl_accessor :foo, :default=>:construct

    k1.foo.should == 1
  end

  it "should call it when proc given" do
    k1 = Class.new
    k1.dsl_accessor :foo, :default=>proc{1}
    k1.foo.should == 1
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
dsl_accessor-0.4.2 spec/default_spec.rb
genki-dsl_accessor-0.4.3 spec/default_spec.rb
genki-dsl_accessor-0.4.2 spec/default_spec.rb
dsl_accessor-0.4.1 spec/default_spec.rb
dsl_accessor-0.4.0 spec/default_spec.rb