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
7ea39df9
Commit
7ea39df9
authored
Dec 19, 2019
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve specs by defining anonymous instead of named classes
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
56a7cabe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
13 deletions
+16
-13
spec/models/concerns/safe_url_spec.rb
spec/models/concerns/safe_url_spec.rb
+8
-6
spec/validators/qualified_domain_array_validator_spec.rb
spec/validators/qualified_domain_array_validator_spec.rb
+8
-7
No files found.
spec/models/concerns/safe_url_spec.rb
View file @
7ea39df9
...
...
@@ -4,17 +4,19 @@ require 'spec_helper'
describe
SafeUrl
do
describe
'#safe_url'
do
class
SafeUrlTestClass
include
SafeUrl
let
(
:safe_url_test_class
)
do
Class
.
new
do
include
SafeUrl
attr_reader
:url
attr_reader
:url
def
initialize
(
url
)
@url
=
url
def
initialize
(
url
)
@url
=
url
end
end
end
let
(
:test_class
)
{
SafeUrlTestC
lass
.
new
(
url
)
}
let
(
:test_class
)
{
safe_url_test_c
lass
.
new
(
url
)
}
let
(
:url
)
{
'http://example.com'
}
subject
{
test_class
.
safe_url
}
...
...
spec/validators/qualified_domain_array_validator_spec.rb
View file @
7ea39df9
...
...
@@ -3,18 +3,19 @@
require
'spec_helper'
describe
QualifiedDomainArrayValidator
do
class
QualifiedDomainArrayValidatorTestClass
include
ActiveModel
::
Validations
let
(
:qualified_domain_array_validator_test_class
)
do
Class
.
new
do
include
ActiveModel
::
Validations
attr_accessor
:domain_array
attr_accessor
:domain_array
def
initialize
(
domain_array
)
self
.
domain_array
=
domain_array
def
initialize
(
domain_array
)
self
.
domain_array
=
domain_array
end
end
end
let!
(
:record
)
do
QualifiedDomainArrayValidatorTestC
lass
.
new
([
'gitlab.com'
])
qualified_domain_array_validator_test_c
lass
.
new
([
'gitlab.com'
])
end
subject
{
validator
.
validate
(
record
)
}
...
...
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