Sha256: 27912a3d56e8b78300037a82088600d48838894883c483b669e5efe18864c24f
Contents?: true
Size: 1.68 KB
Versions: 11
Compression:
Stored size: 1.68 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. .. spec_helper])) describe Ziya::Charts::Support::Draw do before( :each ) do @comp = Ziya::Charts::Support::Draw.new circle = Ziya::Charts::Support::Circle.new circle.radius = 10 image = Ziya::Charts::Support::Image.new image.x = 10 text = Ziya::Charts::Support::Text.new text.x = 20 # text.y = 10 text.text = "Hello World" @comp.components = [circle, image, text] end it "should define the correct attribute methods" do lambda{ Ziya::Charts::Support::Draw.attributes[@comp.class.name].each { |m| @comp.send( m ) } }.should_not raise_error end describe "#flatten" do before( :each ) do @xml = Builder::XmlMarkup.new end it "should flatten component correctly" do @comp.flatten( @xml ).should == "<draw><circle radius=\"10\"/><image x=\"10\"/><text x=\"20\">Hello World</text></draw>" end it "should support composite charts" do urls = { :fred => { :url => "/fred" }, :blee => { :url => "/blee" } } @comp.flatten( @xml, urls ).should == "<draw><circle radius=\"10\"/><image x=\"10\"/><text x=\"20\">Hello World</text><image url=\"/charts/charts.swf?library_path=/charts/charts_library&xml_source=%2Fblee&chart_id=blee\"/><image url=\"/charts/charts.swf?library_path=/charts/charts_library&xml_source=%2Ffred&chart_id=fred\"/></draw>" end it "should support composite chart with options" do urls = { :fred => { :url => "/fred", :transition => "slide_left", :duration => 1 } } @comp.flatten( @xml, urls ).index( "transition=\"slide_left\"" ).should_not be_nil end end end
Version data entries
11 entries across 11 versions & 2 rubygems