Sha256: e32f682865f3bc41c8c2d6b57c7276b002d82c1861d14530b8c369638ea7233e

Contents?: true

Size: 1.19 KB

Versions: 17

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

describe RSpecCandy do
  describe 'matchers' do
    describe 'be_same_second_as' do

      it 'should consider equal two Times with the same second' do
        Time.parse('2012-05-01 14:15:16').should be_same_second_as(Time.parse('2012-05-01 14:15:16'))
        Time.parse('2012-05-01 14:15:17').should_not be_same_second_as(Time.parse('2012-05-01 14:15:16'))
      end

      it 'should ignore sub-second differences' do
        Time.parse('2012-05-01 00:00:00.1').should be_same_second_as(Time.parse('2012-05-01 00:00:00.2'))
      end

      it 'should correctly compare Time and DateTime objects' do
        Time.parse('2012-05-01 14:15:16 +0000').should be_same_second_as(DateTime.parse('2012-05-01 14:15:16 +0000'))
        Time.parse('2012-05-01 14:15:17 +0000').should_not be_same_second_as(DateTime.parse('2012-05-01 14:15:16 +0000'))
        Time.parse('2012-05-01 00:00:00.1 +0000').should be_same_second_as(DateTime.parse('2012-05-01 00:00:00.2 +0000'))
      end

      it 'should consider different two times in different zones' do
        Time.parse('2012-05-01 14:15:16 +0000').should_not be_same_second_as(Time.parse('2012-05-01 14:15:16 +0100'))
      end

    end
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rspec_candy-0.5.1 spec/rspec_candy/matchers/be_same_second_as_spec.rb
rspec_candy-0.5.0 spec/rspec_candy/matchers/be_same_second_as_spec.rb
rspec_candy-0.4.1 spec/rspec_candy/matchers/be_same_second_as_spec.rb
rspec_candy-0.4.0 spec/rspec_candy/matchers/be_same_second_as_spec.rb
rspec_candy-0.3.1 spec/shared/rspec_candy/matchers/be_same_second_as_spec.rb
rspec_candy-0.3.0 spec/shared/rspec_candy/matchers/be_same_second_as_spec.rb
rspec_candy-0.2.10 spec/shared/rspec_candy/matchers/be_same_second_as_spec.rb
rspec_candy-0.2.9 spec/shared/rspec_candy/matchers/be_same_second_as_spec.rb
rspec_candy-0.2.8 spec/shared/rspec_candy/matchers/be_same_second_as_spec.rb
rspec_candy-0.2.7 spec/shared/rspec_candy/matchers/be_same_second_as_spec.rb
rspec_candy-0.2.6 spec/shared/rspec_candy/matchers/be_same_second_as_spec.rb
rspec_candy-0.2.5 spec/shared/rspec_candy/matchers/be_same_second_as_spec.rb
rspec_candy-0.2.4 spec/shared/rspec_candy/matchers/be_same_second_as_spec.rb
rspec_candy-0.2.3 spec/shared/rspec_candy/matchers/be_same_second_as_spec.rb
rspec_candy-0.2.2 spec/shared/rspec_candy/matchers/be_same_second_as_spec.rb
rspec_candy-0.2.1 spec/shared/rspec_candy/matchers/be_same_second_as_spec.rb
rspec_candy-0.2.0 spec/shared/rspec_candy/matchers/be_same_second_as_spec.rb