Sha256: a1421802e1a650bd78eb5b90fc689dc2d1139dda1396a2133b024a0d918ad449

Contents?: true

Size: 1.24 KB

Versions: 9

Compression:

Stored size: 1.24 KB

Contents

require_relative '../../../../lib/tf1_converter/config'
require_relative '../../../../lib/tf1_converter/kml/track_color'

module TF1Converter::Kml
  describe TrackColor do
    let(:colors) { [nil, nil].map{|n| TrackColor.next } }

    before(:each) do
      ::TF1Converter::Config.stub(:colors){ {'Blue'=>'1', 'Red'=>'2', 'Yellow'=>'3'}}
    end

    after(:each) do
      ::TF1Converter::Config.unstub!(:use_constant_color)
      ::TF1Converter::Config.unstub!(:colors)
    end

    describe 'no constant coloring' do
      before { ::TF1Converter::Config.stub(:use_constant_color){ false } }

      it 'cycles colors when configured that way' do
        colors[0].should_not == colors[1]
      end

      it 'left pads each color' do
        TrackColor.uncache!
        colors.each{ |v| v.should =~ /^0000000\d$/ }
      end
    end

    describe 'constant coloring' do

      before do
        ::TF1Converter::Config.stub(:use_constant_color){ true }
        ::TF1Converter::Config.stub(:constant_color){ 'c12345' }
      end

      it 'generates a constant color when constant color switch flipped in config' do
        colors[0].should == colors[1]
      end

      it 'left pads the color' do
        colors[0].should == '00c12345'
      end
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
open_gpx_2_kml-1.1.1 spec/lib/tf1_converter/kml/track_color_spec.rb
open_gpx_2_kml-1.0.5 spec/lib/tf1_converter/kml/track_color_spec.rb
open_gpx_2_kml-1.0.4 spec/lib/tf1_converter/kml/track_color_spec.rb
open_gpx_2_kml-1.0.3 spec/lib/tf1_converter/kml/track_color_spec.rb
open_gpx_2_kml-1.0.2 spec/lib/tf1_converter/kml/track_color_spec.rb
open_gpx_2_kml-1.0.1 spec/lib/tf1_converter/kml/track_color_spec.rb
open_gpx_2_kml-1.0.0 spec/lib/tf1_converter/kml/track_color_spec.rb
open_gpx_2_kml-0.10.4 spec/lib/tf1_converter/kml/track_color_spec.rb
open_gpx_2_kml-0.10.3 spec/lib/tf1_converter/kml/track_color_spec.rb