File: singleton.rb

package info (click to toggle)
ruby-ftw 0.0.49-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 548 kB
  • sloc: ruby: 1,922; makefile: 5
file content (19 lines) | stat: -rw-r--r-- 514 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require File.join(File.expand_path(__FILE__).sub(/\/ftw\/.*/, "/testing"))
require "ftw/singleton"

describe FTW::Singleton do
  test "extending with FTW::Singleton gives a singleton method" do
    class Foo
      extend FTW::Singleton
    end
    assert_respond_to(Foo, :singleton)
  end

  test "FTW::Singleton gives a singleton instance" do
    class Foo
      extend FTW::Singleton
    end
    assert_instance_of(Foo, Foo.singleton)
    assert_equal(Foo.singleton.object_id, Foo.singleton.object_id)
  end
end