Sha256: 3b31c4293902856157b513564f859d4926455811bfe16e29558aea531048fde9

Contents?: true

Size: 943 Bytes

Versions: 3

Compression:

Stored size: 943 Bytes

Contents

puts RUBY_DESCRIPTION

if RUBY_DESCRIPTION.start_with? "ruby 1.9"
  require 'simplecov'
  SimpleCov.start
end

require 'easystats'

def build_stats_spec(array, expectations)
  expectations.each do |method, expectation|
    describe "##{method}" do
      context "when #{array.inspect}" do
        if expectation && method == :standard_deviation
          it "should be within #{DELTA} of #{expectation.inspect}" do
            array.send(method).should be_within(DELTA).of(expectation)
          end
        elsif expectation && method == :probability_distribution
          it "should return hash #{expectation.inspect}" do
            array.send(method).each do |key,value|
              value.should be_within(DELTA).of(expectation[key])
            end
          end
        else
          it "should be #{expectation.inspect}" do
            array.send(method).should == expectation
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
easystats-0.5.0 spec/spec_helper.rb
easystats-0.4.0.rc2 spec/spec_helper.rb
easystats-0.4.0.rc1 spec/spec_helper.rb