Commit a6ee0b07 authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch 'vs/rename-extend-reactive-trial-namespace' into 'master'

Add trial suffix to can_extend and can_reactivate methods in the Namespace class

See merge request gitlab-org/gitlab!66061
parents 129f2632 2f53c2d6
......@@ -150,9 +150,9 @@ class TrialsController < ApplicationController
return false unless GitlabSubscription.trial_extension_types.value?(trial_extension_type)
return false if trial_extension_type == GitlabSubscription.trial_extension_types[:extended] && !@namespace.can_extend?
return false if trial_extension_type == GitlabSubscription.trial_extension_types[:extended] && !@namespace.can_extend_trial?
return false if trial_extension_type == GitlabSubscription.trial_extension_types[:reactivated] && !@namespace.can_reactivate?
return false if trial_extension_type == GitlabSubscription.trial_extension_types[:reactivated] && !@namespace.can_reactivate_trial?
true
end
......
......@@ -302,11 +302,11 @@ module EE
trial? && trial_ends_on.present? && trial_ends_on >= Date.today
end
def can_extend?
def can_extend_trial?
trial_active? && !trial_extended_or_reactivated?
end
def can_reactivate?
def can_reactivate_trial?
!trial_active? && !never_had_trial? && !trial_extended_or_reactivated? && free_plan?
end
......
......@@ -1229,10 +1229,10 @@ RSpec.describe Namespace do
end
end
describe '#can_extend?' do
subject { namespace.can_extend? }
describe '#can_extend_trial?' do
subject { namespace.can_extend_trial? }
where(:trial_active, :trial_extended_or_reactivated, :can_extend) do
where(:trial_active, :trial_extended_or_reactivated, :can_extend_trial) do
false | false | false
false | true | false
true | false | true
......@@ -1245,14 +1245,14 @@ RSpec.describe Namespace do
allow(namespace).to receive(:trial_extended_or_reactivated?).and_return(trial_extended_or_reactivated)
end
it { is_expected.to be can_extend }
it { is_expected.to be can_extend_trial }
end
end
describe '#can_reactivate?' do
subject { namespace.can_reactivate? }
describe '#can_reactivate_trial?' do
subject { namespace.can_reactivate_trial? }
where(:trial_active, :never_had_trial, :trial_extended_or_reactivated, :free_plan, :can_reactivate) do
where(:trial_active, :never_had_trial, :trial_extended_or_reactivated, :free_plan, :can_reactivate_trial) do
false | false | false | false | false
false | false | false | true | true
false | false | true | false | false
......@@ -1279,7 +1279,7 @@ RSpec.describe Namespace do
allow(namespace).to receive(:free_plan?).and_return(free_plan)
end
it { is_expected.to be can_reactivate }
it { is_expected.to be can_reactivate_trial }
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