Sha256: 9fc99d974c2c3e474b9976c27f8a8b72973672e3a91faa24b032c0cf751af5d8

Contents?: true

Size: 562 Bytes

Versions: 9

Compression:

Stored size: 562 Bytes

Contents

require_relative '../../helper_no_rails'

class RailsDataExplorer
  module Utils
    describe DataBinner do

      describe '#bin' do

        [
          [
            '1',
            { '1 or less' => 1, '2' => 2, '3' => 3 },
            [0,1,2,3,4],
            ['1 or less', '1 or less', '2', '3', '> 3']
          ],
        ].each do |(name, bin_specs, vals, xpect)|

          it "bins #{ name }" do
            db = DataBinner.new(bin_specs)
            vals.map{ |e| db.bin(e) }.must_equal xpect
          end

        end

      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rails-data-explorer-1.0.4 spec/rails_data_explorer/utils/data_binner_spec.rb
rails-data-explorer-1.0.3 spec/rails_data_explorer/utils/data_binner_spec.rb
rails-data-explorer-1.0.2 spec/rails_data_explorer/utils/data_binner_spec.rb
rails-data-explorer-1.0.1 spec/rails_data_explorer/utils/data_binner_spec.rb
rails-data-explorer-1.0.0 spec/rails_data_explorer/utils/data_binner_spec.rb
rails-data-explorer-0.2.3 spec/rails-data-explorer/utils/data_binner_spec.rb
rails-data-explorer-0.2.2 spec/rails-data-explorer/utils/data_binner_spec.rb
rails-data-explorer-0.2.1 spec/rails-data-explorer/utils/data_binner_spec.rb
rails-data-explorer-0.2.0 spec/rails-data-explorer/utils/data_binner_spec.rb