Commit 3708bb50 authored by Robert Speicher's avatar Robert Speicher

Merge branch '11432-fix-gitlab-subscription-' into 'master'

Fix default value for start date in GitlabSubscription being static

Closes #11432

See merge request gitlab-org/gitlab-ee!12110
parents acad071c 3f020bf9
# frozen_string_literal: true # frozen_string_literal: true
class GitlabSubscription < ApplicationRecord class GitlabSubscription < ApplicationRecord
default_value_for :start_date, Date.today default_value_for(:start_date) { Date.today }
belongs_to :namespace belongs_to :namespace
belongs_to :hosted_plan, class_name: 'Plan' belongs_to :hosted_plan, class_name: 'Plan'
......
require 'spec_helper' require 'spec_helper'
describe GitlabSubscription do describe GitlabSubscription do
around do |example|
Timecop.freeze do
example.run
end
end
describe 'default values' do describe 'default values' do
it do it do
Timecop.freeze(Date.today + 30) do
expect(subject.start_date).to eq(Date.today) expect(subject.start_date).to eq(Date.today)
end end
end end
end
describe 'validations' do describe 'validations' do
it { is_expected.to validate_presence_of(:seats) } it { is_expected.to validate_presence_of(:seats) }
......
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