spec/gchart_spec.rb in mattetti-googlecharts-1.3.7 vs spec/gchart_spec.rb in mattetti-googlecharts-1.4.0

- old
+ new

@@ -58,9 +58,31 @@ Gchart.line(:data => [0, 25], :encoding => 'extended').include?('chd=e:AA..').should be_true end it "should be able to have data with text encoding" do Gchart.line(:data => [10, 5.2, 4, 45, 78], :encoding => 'text').include?('chd=t:10,5.2,4,45,78').should be_true + end + + it "should handle max and min values with text encoding" do + Gchart.line(:data => [10, 5.2, 4, 45, 78], :encoding => 'text').include?('chds=0,78').should be_true + end + + it "should automatically handle negative values with proper max/min limits when using text encoding" do + Gchart.line(:data => [-10, 5.2, 4, 45, 78], :encoding => 'text').include?('chds=-10,78').should be_true + end + + it "should handle negative values with manual max/min limits when using text encoding" do + Gchart.line(:data => [-10, 5.2, 4, 45, 78], :encoding => 'text', :min_value => -20, :max_value => 100).include?('chds=-20,100').should be_true + end + + it "should set the proper axis values when using text encoding and negative values" do + Gchart.bar( :data => [[-10], [100]], + :encoding => 'text', + :horizontal => true, + :min_value => -20, + :max_value => 100, + :axis_with_labels => 'x', + :bar_colors => ['FD9A3B', '4BC7DC']).should include("chxr=0,-20,100") end it "should be able to have muliple set of data with text encoding" do Gchart.line(:data => [[10, 5.2, 4, 45, 78], [20, 40, 70, 15, 99]], :encoding => 'text').include?(Gchart.jstize('chd=t:10,5.2,4,45,78|20,40,70,15,99')).should be_true end \ No newline at end of file