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
Léo-Paul Géneau
gitlab-ce
Commits
601c24d5
Commit
601c24d5
authored
Jan 11, 2018
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add RedirectRoute factory
parent
c517788e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
spec/factories/redirect_routes.rb
spec/factories/redirect_routes.rb
+15
-0
spec/models/route_spec.rb
spec/models/route_spec.rb
+3
-3
No files found.
spec/factories/redirect_routes.rb
0 → 100644
View file @
601c24d5
FactoryBot
.
define
do
factory
:redirect_route
do
sequence
(
:path
)
{
|
n
|
"redirect
#{
n
}
"
}
source
factory: :group
permanent
false
trait
:permanent
do
permanent
true
end
trait
:temporary
do
permanent
false
end
end
end
spec/models/route_spec.rb
View file @
601c24d5
...
...
@@ -23,7 +23,7 @@ describe Route do
context
'when permanent conflicting redirects exist'
do
it
'is invalid'
do
redirect
=
RedirectRoute
.
new
(
path:
'foo/bar/baz'
,
source:
create
(
:group
),
permanent:
true
)
redirect
=
build
(
:redirect_route
,
:permanent
,
path:
'foo/bar/baz'
)
redirect
.
save!
(
validate:
false
)
expect
(
new_route
.
valid?
).
to
be_falsey
...
...
@@ -45,7 +45,7 @@ describe Route do
context
'when permanent conflicting redirects exist'
do
it
'is invalid'
do
redirect
=
RedirectRoute
.
new
(
path:
'foo/bar/baz'
,
source:
create
(
:group
),
permanent:
true
)
redirect
=
build
(
:redirect_route
,
:permanent
,
path:
'foo/bar/baz'
)
redirect
.
save!
(
validate:
false
)
expect
(
route
.
valid?
).
to
be_falsey
...
...
@@ -63,7 +63,7 @@ describe Route do
context
'when path has not changed'
do
context
'when permanent conflicting redirects exist'
do
it
'is valid'
do
redirect
=
RedirectRoute
.
new
(
path:
'git_lab/foo/bar'
,
source:
create
(
:group
),
permanent:
true
)
redirect
=
build
(
:redirect_route
,
:permanent
,
path:
'git_lab/foo/bar'
)
redirect
.
save!
(
validate:
false
)
expect
(
route
.
valid?
).
to
be_truthy
...
...
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