fedora-migrator /vendor/gems/facets-2.4.5/test/core/kernel/test_attr_singleton.rb

Language Ruby Lines 42
MD5 Hash 010b6bf252f9c67e9754e0f8ef10dd23 Estimated Cost $752 (why?)
Repository https://bitbucket.org/mediashelf/fedora-migrator View Raw File
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require 'facets/kernel/attr_singleton.rb'
require 'test/unit'

class TestAttrSingleton < Test::Unit::TestCase

  class AttrSingletonMock
    def initialize
      attr_singleton_reader :foo #=> "FOO"
      attr_singleton_writer :bar #=> "BAR"
      attr_singleton_accessor :baz #=> "BAZ"
      @foo = "FOO"
      self.bar = "BAR"
      self.baz = "BAZ"
    end

    def get_bar
      @bar
    end
  end

  def test_attr_singleton_reader
    assert_nothing_raised { @t = AttrSingletonMock.new }
    assert_equal("FOO", @t.foo)
  end

  def test_attr_singleton_writer
    assert_nothing_raised { @t = AttrSingletonMock.new }
    assert_equal("BAR", @t.get_bar)
    @t.bar = "BAR2"
    assert_equal("BAR2", @t.get_bar)
  end

  def test_attr_singleton_accessor
    assert_nothing_raised { @t = AttrSingletonMock.new }
    assert_equal("BAZ", @t.baz)
    @t.baz = "BAZ2"
    assert_equal("BAZ2", @t.baz)
  end

end
Back to Top