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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
64c9768b
Commit
64c9768b
authored
Jan 26, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use truncate helper on spam logs list
parent
d20e75a8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
15 deletions
+21
-15
app/models/spam_log.rb
app/models/spam_log.rb
+0
-8
app/views/admin/spam_logs/_spam_log.html.haml
app/views/admin/spam_logs/_spam_log.html.haml
+1
-1
features/steps/admin/spam_logs.rb
features/steps/admin/spam_logs.rb
+16
-6
spec/factories/spam_logs.rb
spec/factories/spam_logs.rb
+4
-0
No files found.
app/models/spam_log.rb
View file @
64c9768b
...
@@ -2,12 +2,4 @@ class SpamLog < ActiveRecord::Base
...
@@ -2,12 +2,4 @@ class SpamLog < ActiveRecord::Base
belongs_to
:user
belongs_to
:user
validates
:user
,
presence:
true
validates
:user
,
presence:
true
def
truncated_description
if
description
.
present?
&&
description
.
length
>
100
return
description
[
0
..
100
]
+
"..."
end
description
end
end
end
app/views/admin/spam_logs/_spam_log.html.haml
View file @
64c9768b
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
%td
%td
=
spam_log
.
title
=
spam_log
.
title
%td
%td
=
spam_log
.
truncated_description
=
truncate
(
spam_log
.
description
,
length:
100
)
%td
%td
-
if
user
-
if
user
=
link_to
'Remove user'
,
admin_spam_log_path
(
spam_log
,
remove_user:
true
),
=
link_to
'Remove user'
,
admin_spam_log_path
(
spam_log
,
remove_user:
true
),
...
...
features/steps/admin/spam_logs.rb
View file @
64c9768b
...
@@ -4,15 +4,25 @@ class Spinach::Features::AdminSpamLogs < Spinach::FeatureSteps
...
@@ -4,15 +4,25 @@ class Spinach::Features::AdminSpamLogs < Spinach::FeatureSteps
include
SharedAdmin
include
SharedAdmin
step
'I should see list of spam logs'
do
step
'I should see list of spam logs'
do
page
.
should
have_content
(
"Spam Logs"
)
expect
(
page
).
to
have_content
(
'Spam Logs'
)
spam_log
=
SpamLog
.
first
expect
(
page
).
to
have_content
spam_log
.
source_ip
page
.
should
have_content
spam_log
.
title
expect
(
page
).
to
have_content
spam_log
.
noteable_type
page
.
should
have_content
spam_log
.
description
expect
(
page
).
to
have_content
'N'
page
.
should
have_link
(
"Remove user"
)
expect
(
page
).
to
have_content
spam_log
.
title
page
.
should
have_link
(
"Block user"
)
expect
(
page
).
to
have_content
truncate
(
spam_log
.
description
)
expect
(
page
).
to
have_link
(
'Remove user'
)
expect
(
page
).
to
have_link
(
'Block user'
)
end
end
step
'spam logs exist'
do
step
'spam logs exist'
do
create
(
:spam_log
)
create
(
:spam_log
)
end
end
def
spam_log
@spam_log
||=
SpamLog
.
first
end
def
truncate
(
description
)
"
#{
spam_log
.
description
[
0
...
97
]
}
..."
end
end
end
spec/factories/spam_logs.rb
View file @
64c9768b
...
@@ -3,5 +3,9 @@
...
@@ -3,5 +3,9 @@
FactoryGirl
.
define
do
FactoryGirl
.
define
do
factory
:spam_log
do
factory
:spam_log
do
user
user
source_ip
{
FFaker
::
Internet
.
ip_v4_address
}
noteable_type
'Issue'
title
{
FFaker
::
Lorem
.
sentence
}
description
{
FFaker
::
Lorem
.
paragraph
(
5
)
}
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