Sha256: e156cc83b5903541b31e21609f105d8e42cce09d10d157cc9f8614f8eceb0ecb
Contents?: true
Size: 1.97 KB
Versions: 1
Compression:
Stored size: 1.97 KB
Contents
require File.dirname(__FILE__) + '/test_helper.rb' require 'gather' class SumDumClass include Gather property :aac property :ben property :civ end class Child < SumDumClass property :epi end class TestGather < Test::Unit::TestCase def self.startup end def self.shutdown end def setup @instance = SumDumClass.new @properties = [:aac, :ben, :civ] @child_properties = [ :epi ] end should "have properties" do assert_equal @properties, SumDumClass.properties.to_a end should "have methods" do @properties.each do |prop| assert @instance.respond_to?( prop ) assert @instance.respond_to?( "#{prop}=" ) end end should "have assigned values" do @instance.aac = 'one' assert_equal 'one', @instance.aac end should "have DSL assigned values" do @instance.aac 'two' assert_equal 'two', @instance.aac end should "have [] values" do @instance[:aac] = 'two' assert_equal 'two', @instance[:aac] end should "take a block" do @instance.aac do |one,two| "This is a block" end assert_equal Proc, @instance.aac.class assert_equal 2, @instance.aac.arity assert_equal "This is a block", @instance.aac.call(1,2) end should "be assigned a lambda" do @instance.aac = lambda do |three,four,five| "This is another block" end assert_equal Proc, @instance.aac.class assert_equal 3, @instance.aac.arity assert_equal "This is another block", @instance.aac.call(1,2,3) end should "have hash values" do @instance.aac = 'hey' @instance.ben = 'thewre' @instance.civ = 'dude' hash = {:aac => 'hey', :ben => 'thewre', :civ => 'dude'} assert_equal hash, @instance.to_hash end should_eventually "test merge with a hash" should_eventually "test gather with a block" should_eventually "test gather with a self-block" should_eventually "test gather with a hash" should_eventually "test gather with everything" end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gather-0.0.4 | test/test_gather.rb |