BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
b552a4eb
Commit
b552a4eb
authored
Dec 07, 2016
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate presence of route by Routable concern
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
3f768f9a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
routable.rb
app/models/concerns/routable.rb
+1
-0
routable_spec.rb
spec/models/concerns/routable_spec.rb
+4
-0
No files found.
app/models/concerns/routable.rb
View file @
b552a4eb
...
...
@@ -7,6 +7,7 @@ module Routable
has_one
:route
,
as: :source
,
autosave:
true
,
dependent: :destroy
validates_associated
:route
validates
:route
,
presence:
true
before_validation
:update_route_path
,
if: :full_path_changed?
end
...
...
spec/models/concerns/routable_spec.rb
View file @
b552a4eb
...
...
@@ -3,6 +3,10 @@ require 'spec_helper'
describe
Group
,
'Routable'
do
let!
(
:group
)
{
create
(
:group
)
}
describe
'Validations'
do
it
{
is_expected
.
to
validate_presence_of
(
:route
)
}
end
describe
'Associations'
do
it
{
is_expected
.
to
have_one
(
:route
).
dependent
(
:destroy
)
}
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