Sha256: 2c9db7bd07c21aa5088fe5d6b0207bce01d13daaf2d499b01705a056ae36e819

Contents?: true

Size: 966 Bytes

Versions: 52

Compression:

Stored size: 966 Bytes

Contents

require File.expand_path('../../../spec_helper', __FILE__)

describe "Range#initialize" do
  it "is private" do
    Range.should have_private_instance_method("initialize")
  end

  it "raises an ArgumentError if passed without or with only an argument" do
    lambda { (1..3).__send__(:initialize) }.
      should raise_error(ArgumentError)
    lambda { (1..3).__send__(:initialize, 1) }.
      should raise_error(ArgumentError)
  end

  it "raises a NameError if passed with two or three arguments" do
    lambda { (1..3).__send__(:initialize, 1, 3) }.
      should raise_error(NameError)
    lambda { (1..3).__send__(:initialize, 1, 3, 5) }.
      should raise_error(NameError)
  end

  it "raises an ArgumentError if passed with four or more arguments" do
    lambda { (1..3).__send__(:initialize, 1, 3, 5, 7) }.
      should raise_error(ArgumentError)
    lambda { (1..3).__send__(:initialize, 1, 3, 5, 7, 9) }.
      should raise_error(ArgumentError)
  end
end

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
rhodes-7.6.0 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-7.5.1 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-7.4.1 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-7.1.17 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-6.2.0 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-6.0.11 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-5.5.18 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-5.5.17 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-5.5.15 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-5.5.0.22 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-5.5.2 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-5.5.0.7 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-5.5.0.3 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-5.5.0 spec/framework_spec/app/spec/core/range/initialize_spec.rb
tauplatform-1.0.3 spec/framework_spec/app/spec/core/range/initialize_spec.rb
tauplatform-1.0.2 spec/framework_spec/app/spec/core/range/initialize_spec.rb
tauplatform-1.0.1 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-3.5.1.12 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-3.3.5 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-3.4.2 spec/framework_spec/app/spec/core/range/initialize_spec.rb