Sha256: a32671c125b0380b007c16c6c2c63a5bfe2edc69e40f5e29618b5deb855d9146

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe Ru::Array do
  describe "Array method" do
    it "returns a Ru::Array" do
      array = described_class.new(%w{john paul george ringo})
      array.sort.should be_a(Ru::Array)
    end
  end

  describe "#each_line" do
    it "calls to_s" do
      array = described_class.new((1..3).to_a)
      array.each_line.to_s.to_a.should == described_class.new(('1'..'3'))
    end

    it "calls methods with arguments" do
      array = described_class.new((1..3).to_a)
      array.each_line.modulo(2).to_a.should == [1, 0, 1]
    end
  end

  describe "#map" do
    it "takes one argument" do
      array = described_class.new(%w{john paul george ringo})
      array.map(:reverse).should == %w{nhoj luap egroeg ognir}
    end
    it "takes two arguments" do
      array = described_class.new(%w{john paul george ringo})
      array.map(:[], 0).should == %w{j p g r}
    end

    it "returns a Ru::Array" do
      array = described_class.new(%w{john paul george ringo})
      array.map(:[], 0).should be_a(Ru::Array)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ru-0.1.1 spec/lib/array_spec.rb
ru-0.1.0 spec/lib/array_spec.rb
ru-0.0.3 spec/lib/array_spec.rb
ru-0.0.2 spec/lib/array_spec.rb