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
1f7aefb1
Commit
1f7aefb1
authored
Jul 07, 2017
by
Ruben Davila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some broken specs
parent
787ac5e9
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
19 deletions
+19
-19
app/controllers/admin/trials_controller.rb
app/controllers/admin/trials_controller.rb
+0
-1
app/helpers/license_helper.rb
app/helpers/license_helper.rb
+5
-5
app/models/license.rb
app/models/license.rb
+1
-5
app/views/layouts/header/_ee_trial_banner.html.haml
app/views/layouts/header/_ee_trial_banner.html.haml
+1
-1
features/steps/admin/license.rb
features/steps/admin/license.rb
+1
-1
spec/controllers/admin/trials_controller_spec.rb
spec/controllers/admin/trials_controller_spec.rb
+8
-4
spec/features/admin/admin_trial_spec.rb
spec/features/admin/admin_trial_spec.rb
+3
-2
No files found.
app/controllers/admin/trials_controller.rb
View file @
1f7aefb1
...
@@ -57,5 +57,4 @@ class Admin::TrialsController < Admin::ApplicationController
...
@@ -57,5 +57,4 @@ class Admin::TrialsController < Admin::ApplicationController
'You already have an active license key installed on this server.'
'You already have an active license key installed on this server.'
end
end
end
end
end
end
app/helpers/license_helper.rb
View file @
1f7aefb1
...
@@ -20,11 +20,11 @@ module LicenseHelper
...
@@ -20,11 +20,11 @@ module LicenseHelper
is_trial
=
current_license
.
trial?
is_trial
=
current_license
.
trial?
message
=
[
"Your Enterprise Edition
#{
'trial '
if
is_trial
}
license"
]
message
=
[
"Your Enterprise Edition
#{
'trial '
if
is_trial
}
license"
]
if
current_license
.
expired?
message
<<
if
current_license
.
expired?
message
<<
"expired on
#{
current_license
.
expires_at
}
."
"expired on
#{
current_license
.
expires_at
}
."
else
else
message
<<
"will expire in
#{
pluralize
(
current_license
.
remaining_days
,
'day'
)
}
."
"will expire in
#{
pluralize
(
current_license
.
remaining_days
,
'day'
)
}
."
end
end
message
<<
link_to
(
'Buy now!'
,
Gitlab
::
SUBSCRIPTIONS_PLANS_URL
,
target:
'_blank'
)
if
is_trial
message
<<
link_to
(
'Buy now!'
,
Gitlab
::
SUBSCRIPTIONS_PLANS_URL
,
target:
'_blank'
)
if
is_trial
...
...
app/models/license.rb
View file @
1f7aefb1
...
@@ -143,7 +143,7 @@ class License < ActiveRecord::Base
...
@@ -143,7 +143,7 @@ class License < ActiveRecord::Base
end
end
end
end
delegate
:feature_available?
,
to: :current
,
allow_nil:
true
delegate
:
block_changes?
,
:
feature_available?
,
to: :current
,
allow_nil:
true
def
reset_current
def
reset_current
RequestStore
.
delete
(
:current_license
)
RequestStore
.
delete
(
:current_license
)
...
@@ -156,10 +156,6 @@ class License < ActiveRecord::Base
...
@@ -156,10 +156,6 @@ class License < ActiveRecord::Base
features
[
feature
].
to_i
>
0
features
[
feature
].
to_i
>
0
end
end
def
block_changes?
current
&
.
block_changes?
end
def
load_license
def
load_license
license
=
self
.
last
license
=
self
.
last
...
...
app/views/layouts/header/_ee_trial_banner.html.haml
View file @
1f7aefb1
-
if
current_user
.
admin?
&&
license_message
.
present?
-
if
current_user
&
.
admin?
&&
license_message
.
present?
.alert.alert-dismissible.gitlab-ee-trial-banner.hidden.js-gitlab-ee-trial-banner
{
role:
'alert'
,
'data-license-expiry'
=>
current_license
.
expires_at
}
.alert.alert-dismissible.gitlab-ee-trial-banner.hidden.js-gitlab-ee-trial-banner
{
role:
'alert'
,
'data-license-expiry'
=>
current_license
.
expires_at
}
%button
.close
{
type:
'button'
,
'data-dismiss'
=>
'alert'
,
'aria-label'
=>
'Dismiss banner'
}
%button
.close
{
type:
'button'
,
'data-dismiss'
=>
'alert'
,
'aria-label'
=>
'Dismiss banner'
}
=
icon
(
'times'
,
'aria-hidden'
=>
'true'
)
=
icon
(
'times'
,
'aria-hidden'
=>
'true'
)
...
...
features/steps/admin/license.rb
View file @
1f7aefb1
...
@@ -23,7 +23,7 @@ class Spinach::Features::AdminLicense < Spinach::FeatureSteps
...
@@ -23,7 +23,7 @@ class Spinach::Features::AdminLicense < Spinach::FeatureSteps
end
end
step
'I should see a warning telling me the license has expired'
do
step
'I should see a warning telling me the license has expired'
do
expect
(
page
).
to
have_content
"
The GitLab
Enterprise Edition license expired"
expect
(
page
).
to
have_content
"
Your
Enterprise Edition license expired"
end
end
step
'the current license blocks changes'
do
step
'the current license blocks changes'
do
...
...
spec/controllers/admin/trials_controller_spec.rb
View file @
1f7aefb1
...
@@ -9,11 +9,13 @@ describe Admin::TrialsController do
...
@@ -9,11 +9,13 @@ describe Admin::TrialsController do
describe
'POST #create'
do
describe
'POST #create'
do
context
'without an active license'
do
context
'without an active license'
do
before
{
expect_any_instance_of
(
License
).
to
receive
(
:active?
).
and_return
(
false
)
}
before
do
expect_any_instance_of
(
License
).
to
receive
(
:active?
).
and_return
(
false
)
end
context
'with a successful response from subscription endpoint'
do
context
'with a successful response from subscription endpoint'
do
it
'redirects to the license detail page'
do
it
'redirects to the license detail page'
do
allow_any_instance_of
(
Admin
::
TrialsController
).
to
receive
(
:save_license
).
and_return
(
true
)
allow_any_instance_of
(
described_class
).
to
receive
(
:save_license
).
and_return
(
true
)
post
:create
post
:create
...
@@ -24,7 +26,7 @@ describe Admin::TrialsController do
...
@@ -24,7 +26,7 @@ describe Admin::TrialsController do
context
'with a failing response from subscription endpoint'
do
context
'with a failing response from subscription endpoint'
do
it
'shows an error message'
do
it
'shows an error message'
do
allow_any_instance_of
(
Admin
::
TrialsController
).
to
receive
(
:save_license
).
and_return
(
false
)
allow_any_instance_of
(
described_class
).
to
receive
(
:save_license
).
and_return
(
false
)
post
:create
post
:create
...
@@ -35,7 +37,9 @@ describe Admin::TrialsController do
...
@@ -35,7 +37,9 @@ describe Admin::TrialsController do
end
end
context
'with an active license'
do
context
'with an active license'
do
before
{
expect_any_instance_of
(
License
).
to
receive
(
:active?
).
and_return
(
true
)
}
before
do
expect_any_instance_of
(
License
).
to
receive
(
:active?
).
and_return
(
true
)
end
it
'does not allow creating a trial license'
do
it
'does not allow creating a trial license'
do
post
:create
post
:create
...
...
spec/features/admin/admin_trial_spec.rb
View file @
1f7aefb1
...
@@ -12,7 +12,9 @@ feature "Creating trial license", feature: true do
...
@@ -12,7 +12,9 @@ feature "Creating trial license", feature: true do
{
'license_key'
=>
license_data
}
{
'license_key'
=>
license_data
}
end
end
before
{
License
.
destroy_all
}
before
do
License
.
destroy_all
end
it
'allows the creation of the trial license'
do
it
'allows the creation of the trial license'
do
stub_request
(
:post
,
"
#{
Gitlab
::
SUBSCRIPTIONS_URL
}
/trials"
)
stub_request
(
:post
,
"
#{
Gitlab
::
SUBSCRIPTIONS_URL
}
/trials"
)
...
@@ -54,6 +56,5 @@ feature "Creating trial license", feature: true do
...
@@ -54,6 +56,5 @@ feature "Creating trial license", feature: true do
expect
(
page
).
to
have_content
(
'You have already used a free trial'
)
expect
(
page
).
to
have_content
(
'You have already used a free trial'
)
end
end
end
end
end
end
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