Sha256: 1dae00e7ed270487eb2ec1029521067864dffc057b2eaa7e9ffe30826f366937

Contents?: true

Size: 1.18 KB

Versions: 15

Compression:

Stored size: 1.18 KB

Contents

require 'rubygems'
require 'rubyXL'

describe RubyXL::NumberFormat do

  describe '.is_date_format?' do
    it 'should return true if number format = dd// yy// mm' do
      RubyXL::NumberFormat.new(:num_fmt_id => 1, :format_code => 'dd// yy// mm').is_date_format?().should == true
    end  

    it 'should return true if number format = DD// YY// MM (uppercase)' do
      RubyXL::NumberFormat.new(:num_fmt_id => 1, :format_code => 'DD// YY// MM').is_date_format?().should == true
    end  

    it 'should return false if number format = @' do
      RubyXL::NumberFormat.new(:num_fmt_id => 1, :format_code => '@').is_date_format?().should == false
      RubyXL::NumberFormat.new(:num_fmt_id => 1, :format_code => 'general').is_date_format?().should == false
      RubyXL::NumberFormat.new(:num_fmt_id => 1, :format_code => '0.00e+00').is_date_format?().should == false
    end  

    it 'should properly detect date formats amongst default ones' do
      all_formats = RubyXL::NumberFormats::DEFAULT_NUMBER_FORMATS
      id_list = all_formats.collect { |fmt| fmt.num_fmt_id if fmt.is_date_format? }.compact.sort
      id_list.should == [14, 15, 16, 17, 18, 19, 20, 21, 22, 45, 46, 47]
    end

  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rubyXL-2.5.4 spec/lib/stylesheet_spec.rb
rubyXL-2.5.3 spec/lib/stylesheet_spec.rb
rubyXL-2.5.2 spec/lib/stylesheet_spec.rb
rubyXL-2.5.1 spec/lib/stylesheet_spec.rb
rubyXL-2.5.0 spec/lib/stylesheet_spec.rb
rubyXL-2.4.4 spec/lib/stylesheet_spec.rb
rubyXL-2.4.3 spec/lib/stylesheet_spec.rb
rubyXL-2.4.2 spec/lib/stylesheet_spec.rb
rubyXL-2.4.1 spec/lib/stylesheet_spec.rb
rubyXL-2.4.0 spec/lib/stylesheet_spec.rb
rubyXL-2.3.4 spec/lib/stylesheet_spec.rb
rubyXL-2.3.3 spec/lib/stylesheet_spec.rb
rubyXL-2.3.2 spec/lib/stylesheet_spec.rb
rubyXL-2.3.1 spec/lib/stylesheet_spec.rb
rubyXL-2.3.0 spec/lib/stylesheet_spec.rb