Sha256: 21dfe8e157daf9a1c658960e9e9649518a0edf7c3259cc73525b8b97fd92ca86

Contents?: true

Size: 1.27 KB

Versions: 11

Compression:

Stored size: 1.27 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), %w[.. .. spec_helper]))

describe Ziya::Charts::Support::SeriesColor do
  before( :each ) do
    @comp = Ziya::Charts::Support::SeriesColor.new
  end
    
  it "should define the correct attribute methods" do
    lambda{ Ziya::Charts::Support::SeriesColor.attributes[@comp.class.name].each {
     |m| @comp.send( m ) } }.should_not raise_error
  end
    
  describe "#flatten" do
    before( :each ) do
      @xml     = Builder::XmlMarkup.new
      @results = "<series_color><color>10</color><color>20</color><color>30</color></series_color>"
    end  
    
    it "should flatten string explode version correctly" do
      @comp.colors = "10,20,30"
      @comp.flatten( @xml ).should == @results
    end

    it "should flatten string numbers with spaces explode version correctly" do
      @comp.colors = "10 , 20 , 30"
      @comp.flatten( @xml ).should == @results
    end

    it "should flatten single string explode version correctly" do    
      @comp.colors = 10
      @comp.flatten( @xml ).should == "<series_color><color>10</color></series_color>"
    end
    
    it "should flatten array explode version correctly" do    
      @comp.colors = %w[10 20 30]
      @comp.flatten( @xml ).should == @results
    end    
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
derailed-ziya-2.1.0 spec/charts/support/series_color_spec.rb
derailed-ziya-2.1.1 spec/charts/support/series_color_spec.rb
derailed-ziya-2.1.2 spec/charts/support/series_color_spec.rb
derailed-ziya-2.1.3 spec/charts/support/series_color_spec.rb
derailed-ziya-2.1.4 spec/charts/support/series_color_spec.rb
derailed-ziya-2.1.5 spec/charts/support/series_color_spec.rb
ziya-2.3.0 spec/charts/support/series_color_spec.rb
ziya-2.1.9 spec/charts/support/series_color_spec.rb
ziya-2.1.8 spec/charts/support/series_color_spec.rb
ziya-2.1.7 spec/charts/support/series_color_spec.rb
ziya-2.1.6 spec/charts/support/series_color_spec.rb