spec/scale_linear_spec.rb in rubyvis-0.2.1 vs spec/scale_linear_spec.rb in rubyvis-0.2.2
- old
+ new
@@ -1,6 +1,6 @@
-require File.dirname(__FILE__)+"/spec_helper.rb"
+require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
describe Rubyvis::Scale::Linear do
if Rubyvis::JohnsonLoader.available?
context "direct protovis API comparison" do
before(:all) do
@rt= Rubyvis::JohnsonLoader.new().runtime
@@ -87,14 +87,14 @@
end
it "should returns correct scale" do
@y.scale(@h_dom).should==280
@y[@h_dom].should==280
val=20
- @y.scale(val).should be_close(val.quo(@h_dom)*@h.to_f, 0.001)
+ @y.scale(val).should be_within( 0.001).of(val.quo(@h_dom)*@h.to_f)
end
it "should returns correct invert" do
- @y.invert(100).should be_close(357.1428, 0.001)
- @y.invert(200).should be_close(714.2857, 0.001)
+ @y.invert(100).should be_within( 0.001).of(357.1428)
+ @y.invert(200).should be_within( 0.001).of(714.2857)
end
it "should returns correct ticks" do
@y.ticks.should==[0,100,200,300,400,500,600,700,800,900,1000]
@y.ticks(13).should==[0,100,200,300,400,500,600,700,800,900,1000]
@y.ticks(5).should==[0,200,400,600,800,1000]
\ No newline at end of file