Sha256: ea69c6a6b96544809703f7c7aabd79054c7f161dc266750146b900cbf128e29c

Contents?: true

Size: 823 Bytes

Versions: 5

Compression:

Stored size: 823 Bytes

Contents

require_relative '../../helper_no_rails'

class RailsDataExplorer
  class DataType
    describe Categorical do

      let(:dt) { Categorical.new }
      let(:values) { ['a', 'a', 'b', 'c'] }

      describe "#descriptive_statistics" do

        let(:desc_stats) {
          dt.descriptive_statistics(values)
        }

        it "computes count for each uniq val" do
          desc_stats.detect{ |e| 'a_count' == e[:label] }[:value].must_equal 2
        end

        it "computes percent for each uniq val" do
          desc_stats.detect{ |e| 'a_percent' == e[:label] }[:value].must_equal 50.0
        end

        it "computes total count" do
          desc_stats.detect{ |e| 'Total_count' == e[:label] }[:value].must_equal 4
        end
      end

      describe "#available_chart_types" do
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails-data-explorer-0.2.3 spec/rails-data-explorer/data_type/categorical_spec.rb
rails-data-explorer-0.2.2 spec/rails-data-explorer/data_type/categorical_spec.rb
rails-data-explorer-0.2.1 spec/rails-data-explorer/data_type/categorical_spec.rb
rails-data-explorer-0.2.0 spec/rails-data-explorer/data_type/categorical_spec.rb
rails-data-explorer-0.1.0 spec/rails-data-explorer/data_type/categorical_spec.rb