spec/scale_linear_spec.rb in rubyvis-0.1.7 vs spec/scale_linear_spec.rb in rubyvis-0.2.0
- old
+ new
@@ -105,7 +105,20 @@
@y.domain([0.20147987687960267, 0.996679553296417])
@y.nice
@y.domain().should==[0.2,1]
end
- it "should returns correct tick_format"
+ it "should returns correct tick_format" do
+ @y.tick_format.should be_instance_of Proc
+ @y.tick_format.call( 2).should=='2'
+ @y.tick_format.call(2.0).should=='2'
+ @y.tick_format.call(2.1).should=='2.1'
+ @y.tick_format.call("a").should==''
+ end
+ it "should return correct tick_format for small numbers" do
+ @y.domain(0.00001,0.0001)
+ @y.range(0.000001,0.0001)
+ @y.ticks.should==[1.quo(100000), 1.quo(50000), 3.quo(100000), 1.quo(25000), 1.quo(20000), 3.quo(50000), 7.quo(100000), 1.quo(12500), 9.quo(100000), 1.quo(10000)]
+ @y.tick_format.call(0.2).should=='0.20000'
+
+ end
end
\ No newline at end of file