Sha256: cfc6a7b33720e5db67cbc2865e5b95e5b6494525ffe20cf1c244da061a734120
Contents?: true
Size: 1.46 KB
Versions: 2
Compression:
Stored size: 1.46 KB
Contents
require 'test/unit' require 'rscm/annotations' module RSCM class Whatever attr_accessor :no_annotation ann :boo => "huba luba", :pip => "pip pip" attr_accessor :foo ann :desc => "bang bang" ann :tip => "a top tip" attr_accessor :bar, :zap end class Other attr_accessor :no_annotation ann :boo => "boo" ann :pip => "pip" attr_accessor :foo ann :desc => "desc", :tip => "tip" attr_accessor :bar, :zap end class Subclass < Other end class AnnotationsTest < Test::Unit::TestCase def test_should_handle_annotations_really_well assert_equal("huba luba", Whatever.foo[:boo]) assert_equal("pip pip", Whatever.foo[:pip]) assert_nil(Whatever.bar[:pip]) assert_equal("bang bang", Whatever.bar[:desc]) assert_equal("a top tip", Whatever.bar[:tip]) assert_equal("bang bang", Whatever.zap[:desc]) assert_equal("a top tip", Whatever.zap[:tip]) assert_equal("boo", Other.foo[:boo]) assert_equal("pip", Other.foo[:pip]) assert_nil(Whatever.bar[:pip]) assert_equal("desc", Other.bar[:desc]) assert_equal("tip", Other.bar[:tip]) assert_equal("desc", Other.zap[:desc]) assert_equal("tip", Other.zap[:tip]) end def test_should_inherit_attribute_annotations assert_equal("boo", Subclass.foo[:boo]) assert_equal({:boo => "boo", :pip => "pip"}, Subclass.send("foo")) assert_nil(Whatever.send("no_annotation")) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rscm-0.2.0 | test/rscm/annotations_test.rb |
rscm-0.2.1.1404 | test/rscm/annotations_test.rb |