diff options
Diffstat (limited to 'spec/ruby/core/kernel/loop_spec.rb')
| -rw-r--r-- | spec/ruby/core/kernel/loop_spec.rb | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/spec/ruby/core/kernel/loop_spec.rb b/spec/ruby/core/kernel/loop_spec.rb index f23e3afb02..c2976e5cc5 100644 --- a/spec/ruby/core/kernel/loop_spec.rb +++ b/spec/ruby/core/kernel/loop_spec.rb @@ -1,9 +1,9 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require File.expand_path('../fixtures/classes', __FILE__) +require_relative '../../spec_helper' +require_relative 'fixtures/classes' describe "Kernel.loop" do it "is a private method" do - Kernel.should have_private_instance_method(:loop) + Kernel.private_instance_methods(false).should.include?(:loop) end it "calls block until it is terminated by a break" do @@ -30,7 +30,7 @@ describe "Kernel.loop" do it "returns an enumerator if no block given" do enum = loop - enum.instance_of?(Enumerator).should be_true + enum.instance_of?(Enumerator).should == true cnt = 0 enum.each do |*args| raise "Args should be empty #{args.inspect}" unless args.empty? @@ -55,18 +55,16 @@ describe "Kernel.loop" do end it "does not rescue other errors" do - lambda{ loop do raise StandardError end }.should raise_error( StandardError ) + ->{ loop do raise StandardError end }.should.raise( StandardError ) end - ruby_version_is "2.3" do - it "returns StopIteration#result, the result value of a finished iterator" do - e = Enumerator.new { |y| - y << 1 - y << 2 - :stopped - } - loop { e.next }.should == :stopped - end + it "returns StopIteration#result, the result value of a finished iterator" do + e = Enumerator.new { |y| + y << 1 + y << 2 + :stopped + } + loop { e.next }.should == :stopped end describe "when no block is given" do |
