Sha256: 1be9bddaf30e08fb3fe59d64672f44fab136e66fa078ff54e6c4a5433c6ede8c
Contents?: true
Size: 1.22 KB
Versions: 12
Compression:
Stored size: 1.22 KB
Contents
require 'helper' class TestApp < Test::Unit::TestCase def test_root expected = File.expand_path("#{File.dirname(__FILE__)}/..") assert_equal expected, App::Root.find_starting_in(File.dirname(__FILE__)) assert_equal expected, App::Root.find assert_equal expected, App.root App.root = "foo" assert_equal "foo", App.root App.root = nil assert_equal expected, App.root end def test_object_attributes a = {} assert_raise(NoMethodError) { a.foo } a.define_attribute :foo, "bar" assert_equal("bar", a.foo) a.define_attribute :foo, "baz" assert_equal("baz", a.foo) a.define_attribute :foo, nil assert_equal(nil, a.foo) end def test_benchmark_logger r = [] logger = Logger.new(STDERR) logger.formatter = proc { |_, _, _, msg| r << msg; nil } foo = logger.benchmark { "foo" } assert_equal("foo", foo) assert_equal(["Benchmark: 0 msecs"], r) r = [] foo = logger.benchmark("message") { "foo" } assert_equal("foo", foo) assert_equal(["message: 0 msecs"], r) r = [] foo = logger.benchmark("message", :minimum => 1) { "foo" } assert_equal("foo", foo) assert_equal([], r) end end
Version data entries
12 entries across 12 versions & 2 rubygems