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
6b8a0283
Commit
6b8a0283
authored
Dec 12, 2019
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not track gitlab_subscription creations
parent
56a1cb09
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
19 deletions
+2
-19
ee/app/models/gitlab_subscription.rb
ee/app/models/gitlab_subscription.rb
+0
-5
ee/spec/models/gitlab_subscription_spec.rb
ee/spec/models/gitlab_subscription_spec.rb
+2
-14
No files found.
ee/app/models/gitlab_subscription.rb
View file @
6b8a0283
...
...
@@ -2,7 +2,6 @@
class
GitlabSubscription
<
ApplicationRecord
default_value_for
(
:start_date
)
{
Date
.
today
}
after_create_commit
:log_previous_state_for_create
before_update
:log_previous_state_for_update
after_destroy_commit
:log_previous_state_for_destroy
...
...
@@ -59,10 +58,6 @@ class GitlabSubscription < ApplicationRecord
private
def
log_previous_state_for_create
log_previous_state_to_history
(
:gitlab_subscription_created
)
end
def
log_previous_state_for_update
attrs
=
self
.
attributes
.
merge
(
self
.
attributes_in_database
)
log_previous_state_to_history
(
:gitlab_subscription_updated
,
attrs
)
...
...
ee/spec/models/gitlab_subscription_spec.rb
View file @
6b8a0283
...
...
@@ -243,24 +243,12 @@ describe GitlabSubscription do
expect
(
GitlabSubscriptionHistory
.
attribute_names
-
described_class
.
attribute_names
).
to
eq
(
diff_attrs
)
end
context
'after_create_commit'
do
it
'logs previous state to gitlab subscription history'
do
subject
.
save!
expect
(
GitlabSubscriptionHistory
.
count
).
to
eq
(
1
)
expect
(
GitlabSubscriptionHistory
.
last
.
attributes
).
to
include
(
'gitlab_subscription_id'
=>
subject
.
id
,
'change_type'
=>
'gitlab_subscription_created'
)
end
end
context
'before_update'
do
it
'logs previous state to gitlab subscription history'
do
subject
.
update!
max_seats_used:
42
,
seats:
13
subject
.
update!
max_seats_used:
32
expect
(
GitlabSubscriptionHistory
.
count
).
to
eq
(
2
)
expect
(
GitlabSubscriptionHistory
.
count
).
to
eq
(
1
)
expect
(
GitlabSubscriptionHistory
.
last
.
attributes
).
to
include
(
'gitlab_subscription_id'
=>
subject
.
id
,
'change_type'
=>
'gitlab_subscription_updated'
,
...
...
@@ -279,7 +267,7 @@ describe GitlabSubscription do
subject
.
destroy!
expect
(
GitlabSubscriptionHistory
.
count
).
to
eq
(
2
)
expect
(
GitlabSubscriptionHistory
.
count
).
to
eq
(
1
)
expect
(
GitlabSubscriptionHistory
.
last
.
attributes
).
to
include
(
'gitlab_subscription_id'
=>
subject
.
id
,
'change_type'
=>
'gitlab_subscription_destroyed'
,
...
...
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