Sha256: df6512cb602ec261317837e42d909acec3c68c13dc68900e3560a4167ba29eb9

Contents?: true

Size: 663 Bytes

Versions: 6

Compression:

Stored size: 663 Bytes

Contents

require 'spec_helper'

describe ::SlideRule::DistanceCalculators::DayOfYear do
  context 'when dates are an exact match' do
    it 'should return a 0 distance' do
      expect(described_class.new.calculate('2015-10-8', '2015-10-8')).to eq(0.0)
    end
  end

  context 'when dates are more than a year apart' do
    it 'should return a 1 distance' do
      expect(described_class.new.calculate('2015-10-8', '2016-10-8')).to eq(1)
    end
  end

  context 'when dates are in the same year but different' do
    it 'should return a calculated distance distance' do
      expect(described_class.new.calculate('2015-10-8', '2015-11-8')).to eq(0.08)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
slide_rule-0.2.0 spec/slide_rule/distance_calculators/day_of_year_spec.rb
slide_rule-0.0.4 spec/slide_rule/distance_calculators/day_of_year_spec.rb
slide_rule-0.1.0 spec/slide_rule/distance_calculators/day_of_year_spec.rb
slide_rule-0.0.3 spec/slide_rule/distance_calculators/day_of_year_spec.rb
slide_rule-0.0.2 spec/slide_rule/distance_calculators/day_of_year_spec.rb
slide_rule-0.0.1 spec/slide_rule/distance_calculators/day_of_year_spec.rb