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
aeafb4a6
Commit
aeafb4a6
authored
May 17, 2021
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate sub portal specs to parameterized syntax
parent
0cf021ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
71 deletions
+17
-71
spec/lib/gitlab/subscription_portal_spec.rb
spec/lib/gitlab/subscription_portal_spec.rb
+17
-71
No files found.
spec/lib/gitlab/subscription_portal_spec.rb
View file @
aeafb4a6
...
...
@@ -2,80 +2,26 @@
require
'spec_helper'
RSpec
.
describe
::
Gitlab
::
SubscriptionPortal
do
unless
Gitlab
.
jh?
describe
'.default_subscriptions_url'
do
subject
{
described_class
.
default_subscriptions_url
}
context
'on non test and non dev environments'
do
before
do
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:test?
).
and_return
(
false
)
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:development?
).
and_return
(
false
)
end
it
'returns production subscriptions app URL'
do
is_expected
.
to
eq
(
'https://customers.gitlab.com'
)
end
end
context
'on dev environment'
do
before
do
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:test?
).
and_return
(
false
)
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:development?
).
and_return
(
true
)
end
it
'returns staging subscriptions app url'
do
is_expected
.
to
eq
(
'https://customers.stg.gitlab.com'
)
end
end
RSpec
.
describe
::
Gitlab
::
SubscriptionPortal
,
skip:
Gitlab
.
jh?
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:method_name
,
:test
,
:development
,
:result
)
do
:default_subscriptions_url
|
false
|
false
|
'https://customers.gitlab.com'
:default_subscriptions_url
|
false
|
true
|
'https://customers.stg.gitlab.com'
:default_subscriptions_url
|
true
|
false
|
'https://customers.stg.gitlab.com'
:payment_form_url
|
false
|
false
|
'https://customers.gitlab.com/payment_forms/cc_validation'
:payment_form_url
|
false
|
true
|
'https://customers.stg.gitlab.com/payment_forms/cc_validation'
:payment_form_url
|
true
|
false
|
'https://customers.stg.gitlab.com/payment_forms/cc_validation'
end
context
'on test environment'
do
before
do
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:test?
).
and_return
(
true
)
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:development?
).
and_return
(
false
)
end
with_them
do
subject
{
described_class
.
method
(
method_name
).
call
}
it
'returns staging subscriptions app url'
do
is_expected
.
to
eq
(
'https://customers.stg.gitlab.com'
)
end
end
before
do
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:test?
).
and_return
(
test
)
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:development?
).
and_return
(
development
)
end
describe
'.payment_form_url'
do
subject
{
described_class
.
payment_form_url
}
context
'on non test and non dev environments'
do
before
do
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:test?
).
and_return
(
false
)
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:development?
).
and_return
(
false
)
end
it
'returns URL to production payment form'
do
is_expected
.
to
eq
(
'https://customers.gitlab.com/payment_forms/cc_validation'
)
end
end
context
'on dev environment'
do
before
do
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:test?
).
and_return
(
false
)
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:development?
).
and_return
(
true
)
end
it
'returns URL to staging payment form'
do
is_expected
.
to
eq
(
'https://customers.stg.gitlab.com/payment_forms/cc_validation'
)
end
end
context
'on test environment'
do
before
do
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:test?
).
and_return
(
true
)
allow
(
Rails
).
to
receive_message_chain
(
:env
,
:development?
).
and_return
(
false
)
end
it
'returns URL to staging payment form'
do
is_expected
.
to
eq
(
'https://customers.stg.gitlab.com/payment_forms/cc_validation'
)
end
end
end
it
{
is_expected
.
to
eq
(
result
)
}
end
end
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