require 'delegate'
class Bar < SimpleDelegator
def initialize(obj)
super(obj)
end
end
class Foo
end
require 'minitest/autorun'
describe Bar do
subject { Bar.new(Foo.new) }
it "assert kind of Bar" do
assert_kind_of(Bar, subject)
end
it "must be kind of Bar" do
subject.must_be_kind_of Bar
end
it "assert instance of Bar" do
assert_instance_of(Bar, subject)
end
it "must be instance of Bar" do
subject.must_be_instance_of Bar
end
end
➜ ~ /usr/bin/ruby mini.rb
Run options: --seed 24089
# Running:
F.F.
Finished in 0.004433s, 902.2708 runs/s, 902.2708 assertions/s.
1) Failure:
Bar#test_0004_must be instance of Bar [mini.rb:30]:
Expected #<Foo:0x00000002f49320> to be an instance of Bar, not Foo.
2) Failure:
Bar#test_0002_must be kind of Bar [mini.rb:22]:
Expected #<Foo:0x00000002f3ee20> to be a kind of Bar, not Foo.
4 runs, 4 assertions, 2 failures, 0 errors, 0 skips