spec/timeliness/format_spec.rb in timeliness-0.4.3 vs spec/timeliness/format_spec.rb in timeliness-0.4.4

- old
+ new

@@ -14,10 +14,16 @@ it 'should raise compilation error for bad format' do expect { Timeliness::Format.new('|--[)').compile! }.to raise_error(Timeliness::Format::CompilationFailed) end + + it 'should raise compilation error if token with captured arg is present more than once' do + expect { + Timeliness::Format.new('dd-mm-yyyy-dd').compile! + }.to raise_error(Timeliness::Format::CompilationFailed) + end end describe "#process" do it "should define method which outputs date array with values in correct order" do expect(format_for('yyyy-mm-dd').process('2000', '1', '2')).to eq [2000,1,2,nil,nil,nil,nil,nil] @@ -71,11 +77,11 @@ let(:format) { format_for('dd mmm yyyy') } context "with I18n loaded" do before(:all) do I18n.locale = :es - I18n.backend.store_translations :es, :date => { :month_names => %w{ ~ Enero Febrero Marzo } } - I18n.backend.store_translations :es, :date => { :abbr_month_names => %w{ ~ Ene Feb Mar } } + I18n.backend.store_translations :es, date: { month_names: %w{ ~ Enero Febrero Marzo } } + I18n.backend.store_translations :es, date: { abbr_month_names: %w{ ~ Ene Feb Mar } } end it 'should parse abbreviated month for current locale to correct value' do expect(format.process('2', 'Ene', '2000')).to eq [2000,1,2,nil,nil,nil,nil,nil] end