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
47251b85
Commit
47251b85
authored
May 18, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ensure_length_of -> validate_length_of
parent
07215f7f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
11 deletions
+11
-11
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+1
-1
spec/models/key_spec.rb
spec/models/key_spec.rb
+2
-2
spec/models/project_spec.rb
spec/models/project_spec.rb
+4
-4
spec/models/snippet_spec.rb
spec/models/snippet_spec.rb
+2
-2
spec/models/user_spec.rb
spec/models/user_spec.rb
+1
-1
spec/support/matchers.rb
spec/support/matchers.rb
+1
-1
No files found.
spec/models/concerns/issuable_spec.rb
View file @
47251b85
...
...
@@ -16,7 +16,7 @@ describe Issue, "Issuable" do
it
{
is_expected
.
to
validate_presence_of
(
:iid
)
}
it
{
is_expected
.
to
validate_presence_of
(
:author
)
}
it
{
is_expected
.
to
validate_presence_of
(
:title
)
}
it
{
is_expected
.
to
ensur
e_length_of
(
:title
).
is_at_least
(
0
).
is_at_most
(
255
)
}
it
{
is_expected
.
to
validat
e_length_of
(
:title
).
is_at_least
(
0
).
is_at_most
(
255
)
}
end
describe
"Scope"
do
...
...
spec/models/key_spec.rb
View file @
47251b85
...
...
@@ -26,8 +26,8 @@ describe Key do
describe
"Validation"
do
it
{
is_expected
.
to
validate_presence_of
(
:title
)
}
it
{
is_expected
.
to
validate_presence_of
(
:key
)
}
it
{
is_expected
.
to
ensur
e_length_of
(
:title
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
ensur
e_length_of
(
:key
).
is_within
(
0
..
5000
)
}
it
{
is_expected
.
to
validat
e_length_of
(
:title
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
validat
e_length_of
(
:key
).
is_within
(
0
..
5000
)
}
end
describe
"Methods"
do
...
...
spec/models/project_spec.rb
View file @
47251b85
...
...
@@ -69,14 +69,14 @@ describe Project do
it
{
is_expected
.
to
validate_presence_of
(
:name
)
}
it
{
is_expected
.
to
validate_uniqueness_of
(
:name
).
scoped_to
(
:namespace_id
)
}
it
{
is_expected
.
to
ensur
e_length_of
(
:name
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
validat
e_length_of
(
:name
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
validate_presence_of
(
:path
)
}
it
{
is_expected
.
to
validate_uniqueness_of
(
:path
).
scoped_to
(
:namespace_id
)
}
it
{
is_expected
.
to
ensur
e_length_of
(
:path
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
ensur
e_length_of
(
:description
).
is_within
(
0
..
2000
)
}
it
{
is_expected
.
to
validat
e_length_of
(
:path
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
validat
e_length_of
(
:description
).
is_within
(
0
..
2000
)
}
it
{
is_expected
.
to
validate_presence_of
(
:creator
)
}
it
{
is_expected
.
to
ensur
e_length_of
(
:issues_tracker_id
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
validat
e_length_of
(
:issues_tracker_id
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
validate_presence_of
(
:namespace
)
}
it
'should not allow new projects beyond user limits'
do
...
...
spec/models/snippet_spec.rb
View file @
47251b85
...
...
@@ -38,10 +38,10 @@ describe Snippet do
it
{
is_expected
.
to
validate_presence_of
(
:author
)
}
it
{
is_expected
.
to
validate_presence_of
(
:title
)
}
it
{
is_expected
.
to
ensur
e_length_of
(
:title
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
validat
e_length_of
(
:title
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
validate_presence_of
(
:file_name
)
}
it
{
is_expected
.
to
ensur
e_length_of
(
:file_name
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
validat
e_length_of
(
:file_name
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
validate_presence_of
(
:content
)
}
...
...
spec/models/user_spec.rb
View file @
47251b85
...
...
@@ -96,7 +96,7 @@ describe User do
it
{
is_expected
.
to
allow_value
(
0
).
for
(
:projects_limit
)
}
it
{
is_expected
.
not_to
allow_value
(
-
1
).
for
(
:projects_limit
)
}
it
{
is_expected
.
to
ensur
e_length_of
(
:bio
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
validat
e_length_of
(
:bio
).
is_within
(
0
..
255
)
}
describe
'email'
do
it
'accepts info@example.com'
do
...
...
spec/support/matchers.rb
View file @
47251b85
...
...
@@ -70,7 +70,7 @@ end
# Extend shoulda-matchers
module
Shoulda::Matchers::ActiveModel
class
Ensur
eLengthOfMatcher
class
Validat
eLengthOfMatcher
# Shortcut for is_at_least and is_at_most
def
is_within
(
range
)
is_at_least
(
range
.
min
)
&&
is_at_most
(
range
.
max
)
...
...
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