-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef41081
commit 96dbb69
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require_relative "test_helper" | ||
require "delegate" | ||
|
||
class SimpleDelegatorInstanceTest < Test::Unit::TestCase | ||
include TypeAssertions | ||
|
||
library "delegate" | ||
testing "::SimpleDelegator[::String]" | ||
|
||
def test_get_obj | ||
assert_send_type "() -> String", | ||
string_delegator, :__getobj__ | ||
end | ||
|
||
def test_delegate_method | ||
assert_send_type "(String) -> String", | ||
string_delegator, :<<, " world" | ||
end | ||
|
||
private | ||
|
||
def string_delegator | ||
Class.new(SimpleDelegator) do | ||
def initialize | ||
super("world") | ||
end | ||
end.new | ||
end | ||
end |