Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
537bfae6
Commit
537bfae6
authored
Jun 14, 2021
by
Alper Akgun
Committed by
Jose Ivan Vargas
Jun 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Settings search should not appear in billings page
parent
c61122f9
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
82 additions
and
10 deletions
+82
-10
app/views/shared/_search_settings.html.haml
app/views/shared/_search_settings.html.haml
+2
-0
ee/app/controllers/groups/billings_controller.rb
ee/app/controllers/groups/billings_controller.rb
+1
-0
ee/app/controllers/profiles/billings_controller.rb
ee/app/controllers/profiles/billings_controller.rb
+1
-0
ee/spec/features/groups/billing_spec.rb
ee/spec/features/groups/billing_spec.rb
+13
-3
ee/spec/features/profiles/billing_spec.rb
ee/spec/features/profiles/billing_spec.rb
+47
-0
ee/spec/features/trials/show_trial_banner_spec.rb
ee/spec/features/trials/show_trial_banner_spec.rb
+2
-7
ee/spec/support/helpers/subscription_portal_helpers.rb
ee/spec/support/helpers/subscription_portal_helpers.rb
+16
-0
No files found.
app/views/shared/_search_settings.html.haml
View file @
537bfae6
-
return
if
@hide_search_settings
-
container_class
=
local_assigns
.
fetch
(
:container_class
,
'gl-mt-5'
)
-
container_class
=
local_assigns
.
fetch
(
:container_class
,
'gl-mt-5'
)
%div
{
class:
container_class
}
%div
{
class:
container_class
}
...
...
ee/app/controllers/groups/billings_controller.rb
View file @
537bfae6
...
@@ -9,6 +9,7 @@ class Groups::BillingsController < Groups::ApplicationController
...
@@ -9,6 +9,7 @@ class Groups::BillingsController < Groups::ApplicationController
feature_category
:purchase
feature_category
:purchase
def
index
def
index
@hide_search_settings
=
true
@top_most_group
=
@group
.
root_ancestor
if
@group
.
has_parent?
@top_most_group
=
@group
.
root_ancestor
if
@group
.
has_parent?
relevant_group
=
(
@top_most_group
||
@group
)
relevant_group
=
(
@top_most_group
||
@group
)
current_plan
=
relevant_group
.
plan_name_for_upgrading
current_plan
=
relevant_group
.
plan_name_for_upgrading
...
...
ee/app/controllers/profiles/billings_controller.rb
View file @
537bfae6
...
@@ -6,6 +6,7 @@ class Profiles::BillingsController < Profiles::ApplicationController
...
@@ -6,6 +6,7 @@ class Profiles::BillingsController < Profiles::ApplicationController
feature_category
:purchase
feature_category
:purchase
def
index
def
index
@hide_search_settings
=
true
@plans_data
=
GitlabSubscriptions
::
FetchSubscriptionPlansService
@plans_data
=
GitlabSubscriptions
::
FetchSubscriptionPlansService
.
new
(
plan:
current_user
.
namespace
.
plan_name_for_upgrading
,
namespace_id:
current_user
.
namespace_id
)
.
new
(
plan:
current_user
.
namespace
.
plan_name_for_upgrading
,
namespace_id:
current_user
.
namespace_id
)
.
execute
.
execute
...
...
ee/spec/features/groups/billing_spec.rb
View file @
537bfae6
...
@@ -29,12 +29,18 @@ RSpec.describe 'Groups > Billing', :js do
...
@@ -29,12 +29,18 @@ RSpec.describe 'Groups > Billing', :js do
sign_in
(
user
)
sign_in
(
user
)
end
end
shared_examples
'hides search settings'
do
it
'does not have search settings'
do
visit
group_billings_path
(
group
)
expect
(
page
).
not_to
have_field
(
placeholder:
SearchHelpers
::
INPUT_PLACEHOLDER
)
end
end
context
'when CustomersDot is available'
do
context
'when CustomersDot is available'
do
before
do
before
do
stub_eoa_eligibility_request
(
group
.
id
)
stub_eoa_eligibility_request
(
group
.
id
)
stub_full_request
(
"
#{
EE
::
SUBSCRIPTIONS_URL
}
/gitlab_plans?plan=
#{
plan
}
&namespace_id=
#{
group
.
id
}
"
)
stub_billing_plans
(
group
.
id
,
plan
)
.
with
(
headers:
{
'Accept'
=>
'application/json'
})
.
to_return
(
status:
200
,
body:
File
.
new
(
Rails
.
root
.
join
(
'ee/spec/fixtures/gitlab_com_plans.json'
)))
end
end
context
'with a free plan'
do
context
'with a free plan'
do
...
@@ -44,6 +50,8 @@ RSpec.describe 'Groups > Billing', :js do
...
@@ -44,6 +50,8 @@ RSpec.describe 'Groups > Billing', :js do
create
(
:gitlab_subscription
,
namespace:
group
,
hosted_plan:
nil
,
seats:
15
)
create
(
:gitlab_subscription
,
namespace:
group
,
hosted_plan:
nil
,
seats:
15
)
end
end
it_behaves_like
'hides search settings'
it
'shows the proper title and subscription data'
do
it
'shows the proper title and subscription data'
do
visit
group_billings_path
(
group
)
visit
group_billings_path
(
group
)
...
@@ -63,6 +71,8 @@ RSpec.describe 'Groups > Billing', :js do
...
@@ -63,6 +71,8 @@ RSpec.describe 'Groups > Billing', :js do
create
(
:gitlab_subscription
,
namespace:
group
,
hosted_plan:
bronze_plan
,
seats:
15
)
create
(
:gitlab_subscription
,
namespace:
group
,
hosted_plan:
bronze_plan
,
seats:
15
)
end
end
it_behaves_like
'hides search settings'
it
'shows the proper title and subscription data'
do
it
'shows the proper title and subscription data'
do
extra_seats_url
=
"
#{
EE
::
SUBSCRIPTIONS_URL
}
/gitlab/namespaces/
#{
group
.
id
}
/extra_seats"
extra_seats_url
=
"
#{
EE
::
SUBSCRIPTIONS_URL
}
/gitlab/namespaces/
#{
group
.
id
}
/extra_seats"
renew_url
=
"
#{
EE
::
SUBSCRIPTIONS_URL
}
/gitlab/namespaces/
#{
group
.
id
}
/renew"
renew_url
=
"
#{
EE
::
SUBSCRIPTIONS_URL
}
/gitlab/namespaces/
#{
group
.
id
}
/renew"
...
...
ee/spec/features/profiles/billing_spec.rb
0 → 100644
View file @
537bfae6
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'Profiles > Billing'
,
:js
do
include
StubRequests
include
SubscriptionPortalHelpers
let_it_be
(
:namespace
)
{
create
(
:namespace
)
}
let_it_be
(
:user
)
{
create
(
:user
,
namespace:
namespace
)
}
let_it_be
(
:bronze_plan
)
{
create
(
:bronze_plan
)
}
def
formatted_date
(
date
)
date
.
strftime
(
"%B %-d, %Y"
)
end
def
subscription_table
'.subscription-table'
end
before
do
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
stub_application_setting
(
check_namespace_plan:
true
)
sign_in
(
user
)
end
context
'when CustomersDot is available'
do
let
(
:plan
)
{
'free'
}
before
do
stub_billing_plans
(
user
.
namespace
.
id
,
plan
)
end
context
'with a free plan'
do
let!
(
:subscription
)
do
create
(
:gitlab_subscription
,
namespace:
user
.
namespace
,
hosted_plan:
nil
)
end
it
'does not have search settings field'
do
visit
profile_billings_path
expect
(
page
).
not_to
have_field
(
placeholder:
SearchHelpers
::
INPUT_PLACEHOLDER
)
end
end
end
end
ee/spec/features/trials/show_trial_banner_spec.rb
View file @
537bfae6
...
@@ -4,21 +4,16 @@ require 'spec_helper'
...
@@ -4,21 +4,16 @@ require 'spec_helper'
RSpec
.
describe
'Show trial banner'
,
:js
do
RSpec
.
describe
'Show trial banner'
,
:js
do
include
StubRequests
include
StubRequests
include
SubscriptionPortalHelpers
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:group
)
{
create
(
:group
)
}
let!
(
:group
)
{
create
(
:group
)
}
let!
(
:ultimate_plan
)
{
create
(
:ultimate_plan
)
}
let!
(
:ultimate_plan
)
{
create
(
:ultimate_plan
)
}
let
(
:plans_data
)
do
Gitlab
::
Json
.
parse
(
File
.
read
(
Rails
.
root
.
join
(
'ee/spec/fixtures/gitlab_com_plans.json'
))).
map
do
|
data
|
data
.
deep_symbolize_keys
end
end
before
do
before
do
stub_application_setting
(
check_namespace_plan:
true
)
stub_application_setting
(
check_namespace_plan:
true
)
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
).
at_least
(
:once
)
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
).
at_least
(
:once
)
stub_full_request
(
"
#{
EE
::
SUBSCRIPTIONS_URL
}
/gitlab_plans?plan=free&namespace_id=
#{
namespace_id
}
"
)
stub_billing_plans
(
namespace_id
)
.
to_return
(
status:
200
,
body:
plans_data
.
to_json
)
group
.
add_owner
(
user
)
group
.
add_owner
(
user
)
create
(
:gitlab_subscription
,
namespace:
user
.
namespace
,
hosted_plan:
ultimate_plan
,
trial:
true
,
trial_ends_on:
Date
.
current
+
1
.
month
)
create
(
:gitlab_subscription
,
namespace:
user
.
namespace
,
hosted_plan:
ultimate_plan
,
trial:
true
,
trial_ends_on:
Date
.
current
+
1
.
month
)
...
...
ee/spec/support/helpers/subscription_portal_helpers.rb
View file @
537bfae6
...
@@ -21,8 +21,24 @@ module SubscriptionPortalHelpers
...
@@ -21,8 +21,24 @@ module SubscriptionPortalHelpers
)
)
end
end
def
billing_plans_data
Gitlab
::
Json
.
parse
(
plans_fixture
).
map
do
|
data
|
data
.
deep_symbolize_keys
end
end
def
stub_billing_plans
(
namespace_id
,
plan
=
'free'
)
stub_full_request
(
"
#{
EE
::
SUBSCRIPTIONS_URL
}
/gitlab_plans?namespace_id=
#{
namespace_id
}
&plan=
#{
plan
}
"
)
.
with
(
headers:
{
'Accept'
=>
'application/json'
})
.
to_return
(
status:
200
,
body:
plans_fixture
)
end
private
private
def
plans_fixture
File
.
new
(
Rails
.
root
.
join
(
'ee/spec/fixtures/gitlab_com_plans.json'
))
end
def
stubbed_eoa_eligibility_response_body
(
eligible
,
free_upgrade_plan_id
,
assisted_upgrade_plan_id
)
def
stubbed_eoa_eligibility_response_body
(
eligible
,
free_upgrade_plan_id
,
assisted_upgrade_plan_id
)
{
{
"data"
:
{
"data"
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment