Sha256: 5a234e5534874757cef3b14de225c1215e01052472247273c9b8107e0fe553a4

Contents?: true

Size: 862 Bytes

Versions: 3

Compression:

Stored size: 862 Bytes

Contents

require 'spec_helper'

module Susply
  describe Calculations do
    let(:start) { Time.zone.now }
    describe ".end_period_calculation" do
      it "returns one year when plan interval is yearly" do
        interval = 'yearly'
        result = Susply::Calculations.end_period_calculation(start, interval)

        expect(result).to eq(start + 1.year)
      end

      it "returns one month when plan interval is monthly" do
        interval = 'monthly'
        result = Susply::Calculations.end_period_calculation(start, interval)

        expect(result).to eq(start + 1.month)
      end
      
      it "returns one month when there is not register interval" do
        interval = 'not-registered-interval'
        result = Susply::Calculations.end_period_calculation(start, interval)

        expect(result).to eq(start + 1.month)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
susply-1.0.0 spec/services/susply/calculations_spec.rb
susply-0.0.2 spec/services/susply/calculations_spec.rb
susply-0.0.1 spec/services/susply/calculations_spec.rb