spec/spec_helper.rb in easystats-0.3.1 vs spec/spec_helper.rb in easystats-0.3.2
- old
+ new
@@ -1,5 +1,27 @@
-require 'simplecov'
-SimpleCov.start
+puts RUBY_DESCRIPTION
+if RUBY_VERSION.to_f >= 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
+ if expectation && method == :standard_deviation
+ it "should be within #{DELTA} of #{expectation.inspect}" do
+ array.send(method).should be_within(DELTA).of(expectation)
+ end
+ else
+ it "should be #{expectation.inspect}" do
+ array.send(method).should == expectation
+ end
+ end
+ end
+ end
+ end
+end