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-3.2.2 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-3.2.2.beta spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-3.2.1 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-3.2.0 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-3.2.0.beta.9 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-3.2.0.beta.8 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-3.2.0.beta.7 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-3.2.0.beta.6 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-3.2.0.beta.5 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-3.2.0.beta.4 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-3.2.0.beta.2 spec/framework_spec/app/spec/core/range/initialize_spec.rb
rhodes-3.2.0.beta.1 spec/framework_spec/app/spec/core/range/initialize_spec.rb