mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
67078e81f5
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
20 lines
533 B
Ruby
20 lines
533 B
Ruby
describe :kernel_then, shared: true do
|
|
it "yields self" do
|
|
object = Object.new
|
|
object.send(@method) { |o| o.should equal object }
|
|
end
|
|
|
|
it "returns the block return value" do
|
|
object = Object.new
|
|
object.send(@method) { 42 }.should equal 42
|
|
end
|
|
|
|
it "returns a sized Enumerator when no block given" do
|
|
object = Object.new
|
|
enum = object.send(@method)
|
|
enum.should be_an_instance_of Enumerator
|
|
enum.size.should equal 1
|
|
enum.peek.should equal object
|
|
enum.first.should equal object
|
|
end
|
|
end
|