spec/spec_helper.rb in easystats-0.3.2 vs spec/spec_helper.rb in easystats-0.4.0.rc1
- old
+ new
@@ -1,20 +1,26 @@
puts RUBY_DESCRIPTION
-if RUBY_VERSION.to_f >= 1.9
+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}" 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