Sha256: 9170a5984a3fe57fe950b573ed932859431cd38ebeaef9eaf7dca35538223e5a

Contents?: true

Size: 871 Bytes

Versions: 1

Compression:

Stored size: 871 Bytes

Contents

require 'spec_helper'

describe Enumerable do
  describe "#sorted_frequencies" do
    it "returns #frequencies sorted by [frequency, value]" do
      enumerable = (0...0)
      enumerable.stub(:frequencies) do
        {
          "White-breasted Nuthatch" => 1,
          "Red-breasted Nuthatch"   => 1,
          "Brown Creeper"           => 1,
          "Squirrel"                => 1,
          "Marmelade"               => 1000,
          :yeah                     => 3,
          :man                      => 3,
          11                        => 12
        }
      end

      enumerable.sorted_frequencies.should == [
        ["Marmelade", 1000],
        [11, 12],
        [:man, 3],
        [:yeah, 3],
        ["Brown Creeper", 1],
        ["Red-breasted Nuthatch", 1],
        ["Squirrel", 1],
        ["White-breasted Nuthatch", 1]
      ]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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