Sha256: dc8d241ea0b95ebe7cbe7a406eb155efbc69d31d43229a1ded1c50008d5f42a8

Contents?: true

Size: 879 Bytes

Versions: 10

Compression:

Stored size: 879 Bytes

Contents

shared_examples_for :hash_iteration_no_block do |method|
  before { @method = method }

  before(:each) do
    @hsh = new_hash(1 => 2, 3 => 4, 5 => 6)
    @empty = new_hash
  end

  ruby_version_is "" ... "1.8.7" do
    it "raises a LocalJumpError when called on a non-empty hash without a block" do
      lambda { @hsh.send(@method) }.should raise_error(LocalJumpError)
    end

    it "does not raise a LocalJumpError when called on an empty hash without a block" do
      @empty.send(@method).should == @empty
    end
  end

  ruby_version_is "1.8.7" do
    it "returns an Enumerator if called on a non-empty hash without a block" do
      @hsh.send(@method).should be_an_instance_of(enumerator_class)
    end

    it "returns an Enumerator if called on an empty hash without a block" do
      @empty.send(@method).should be_an_instance_of(enumerator_class)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
jactive_support-2.1.2 spec/java_ext/map/shared/iteration.rb
jactive_support-3.0.0 spec/java_ext/map/shared/iteration.rb
jactive_support-3.0.0.pre2 spec/java_ext/map/shared/iteration.rb
jactive_support-3.0.0.pre1 spec/java_ext/map/shared/iteration.rb
jactive_support-2.1.1 spec/java_ext/map/shared/iteration.rb
jactive_support-2.1.0 spec/java_ext/map/shared/iteration.rb
jactive_support-2.0.0 spec/java_ext/map/shared/iteration.rb
jactive_support-1.0.2 spec/java_ext/map/shared/iteration.rb
jactive_support-1.0.1-universal-java-1.6 spec/java_ext/map/shared/iteration.rb
jactive_support-1.0.0-universal-java-1.6 spec/java_ext/map/shared/iteration.rb