Sha256: d3ffed6ba65648529419ec92a32e191f51c871d5be1d90749d81ae9794be60a7

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

modes_expectations = {
  []                                          => [],
  [1]                                         => [1],
  [1.0]                                       => [1.0],
  [1, -1]                                     => [-1, 1],
  [3, 1, 3]                                   => [3],
  [3, 1, 3.0]                                 => [3],
  [3.0, 1, 3]                                 => [3.0],
  (0...0)                                     => [],
  (1..1)                                      => [1],
  (0..3)                                      => [0, 1, 2, 3],
  [BigDecimal("0.0")]                         => [BigDecimal("0.0")],
  [BigDecimal("1.0"), -2, BigDecimal("1.0")]  => [BigDecimal("1.0")],
  [:b, :c, :b, :c, :c, :a]                    => [:c]
}

describe Enumerable do
  describe "#modes" do
    modes_expectations.each do |data, expected|
      it "is #{expected.inspect} for #{data.inspect}" do
        modes = data.modes
        modes.should       == expected
        modes.class.should == expected.class
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_stats-1.0.0 spec/enumerable/modes_spec.rb