Commit 3f020bf9 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Fix default value of GitlabSubscription start_date

Makes it Date.today when instantiated and not when the
class was loaded
parent aafcc5bf
# frozen_string_literal: true
class GitlabSubscription < ApplicationRecord
default_value_for :start_date, Date.today
default_value_for(:start_date) { Date.today }
belongs_to :namespace
belongs_to :hosted_plan, class_name: 'Plan'
......
require 'spec_helper'
describe GitlabSubscription do
around do |example|
Timecop.freeze do
example.run
end
end
describe 'default values' do
it do
expect(subject.start_date).to eq(Date.today)
Timecop.freeze(Date.today + 30) do
expect(subject.start_date).to eq(Date.today)
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment