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
6d197471
Commit
6d197471
authored
Jun 14, 2021
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor billing plan specs
parent
385e2d71
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
15 deletions
+7
-15
ee/spec/features/billings/billing_plans_spec.rb
ee/spec/features/billings/billing_plans_spec.rb
+4
-12
ee/spec/support/helpers/subscription_portal_helpers.rb
ee/spec/support/helpers/subscription_portal_helpers.rb
+3
-3
No files found.
ee/spec/features/billings/billing_plans_spec.rb
View file @
6d197471
...
...
@@ -12,18 +12,13 @@ RSpec.describe 'Billing plan pages', :feature, :js do
let
(
:premium_plan
)
{
create
(
:premium_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
let
(
:plans_data
)
{
billing_plans_data
}
before
do
stub_feature_flags
(
show_billing_eoa_banner:
true
)
stub_feature_flags
(
hide_deprecated_billing_plans:
false
)
stub_experiment_for_subject
(
contact_sales_btn_in_app:
true
)
stub_full_request
(
"
#{
EE
::
SUBSCRIPTIONS_URL
}
/gitlab_plans?plan=
#{
plan
.
name
}
&namespace_id=
#{
namespace
.
id
}
"
)
.
to_return
(
status:
200
,
body:
plans_data
.
to_json
)
stub_billing_plans
(
namespace
.
id
,
plan
.
name
,
plans_data
.
to_json
)
stub_eoa_eligibility_request
(
namespace
.
id
)
stub_application_setting
(
check_namespace_plan:
true
)
allow
(
Gitlab
).
to
receive
(
:com?
)
{
true
}
...
...
@@ -416,17 +411,14 @@ RSpec.describe 'Billing plan pages', :feature, :js do
end
context
'on trial'
do
let
(
:plan
)
{
premium
_plan
}
let
(
:plan
)
{
free
_plan
}
let!
(
:subscription
)
do
create
(
:gitlab_subscription
,
namespace:
namespace
,
hosted_plan:
plan
,
create
(
:gitlab_subscription
,
namespace:
namespace
,
hosted_plan:
p
remium_p
lan
,
trial:
true
,
trial_ends_on:
Date
.
current
.
tomorrow
,
seats:
15
)
end
before
do
stub_full_request
(
"
#{
EE
::
SUBSCRIPTIONS_URL
}
/gitlab_plans?plan=free&namespace_id=
#{
namespace
.
id
}
"
)
.
to_return
(
status:
200
,
body:
plans_data
.
to_json
)
visit
page_path
end
...
...
ee/spec/support/helpers/subscription_portal_helpers.rb
View file @
6d197471
...
...
@@ -22,15 +22,15 @@ module SubscriptionPortalHelpers
end
def
billing_plans_data
Gitlab
::
Json
.
parse
(
plans_fixture
).
map
do
|
data
|
Gitlab
::
Json
.
parse
(
plans_fixture
.
read
).
map
do
|
data
|
data
.
deep_symbolize_keys
end
end
def
stub_billing_plans
(
namespace_id
,
plan
=
'free'
)
def
stub_billing_plans
(
namespace_id
,
plan
=
'free'
,
plans_data
=
nil
)
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
)
.
to_return
(
status:
200
,
body:
plans_
data
||
plans_
fixture
)
end
private
...
...
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