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
aa30088f
Commit
aa30088f
authored
Jan 27, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix old version warning when viewing wiki latest version via version_id
parent
b4b41b4c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletion
+33
-1
app/models/wiki_page.rb
app/models/wiki_page.rb
+1
-1
spec/models/wiki_page_spec.rb
spec/models/wiki_page_spec.rb
+32
-0
No files found.
app/models/wiki_page.rb
View file @
aa30088f
...
@@ -110,7 +110,7 @@ class WikiPage
...
@@ -110,7 +110,7 @@ class WikiPage
# Returns boolean True or False if this instance
# Returns boolean True or False if this instance
# is an old version of the page.
# is an old version of the page.
def
historical?
def
historical?
@page
.
historical?
@page
.
historical?
&&
versions
.
first
.
sha
!=
version
.
sha
end
end
# Returns boolean True or False if this instance
# Returns boolean True or False if this instance
...
...
spec/models/wiki_page_spec.rb
View file @
aa30088f
...
@@ -189,6 +189,38 @@ describe WikiPage, models: true do
...
@@ -189,6 +189,38 @@ describe WikiPage, models: true do
end
end
end
end
describe
'#historical?'
do
before
do
create_page
(
'Update'
,
'content'
)
@page
=
wiki
.
find_page
(
'Update'
)
3
.
times
{
|
i
|
@page
.
update
(
"content
#{
i
}
"
)
}
end
after
do
destroy_page
(
'Update'
)
end
it
'returns true when requesting an old version'
do
old_version
=
@page
.
versions
.
last
.
to_s
old_page
=
wiki
.
find_page
(
'Update'
,
old_version
)
expect
(
old_page
.
historical?
).
to
eq
true
end
it
'returns false when requesting latest version'
do
latest_version
=
@page
.
versions
.
first
.
to_s
latest_page
=
wiki
.
find_page
(
'Update'
,
latest_version
)
expect
(
latest_page
.
historical?
).
to
eq
false
end
it
'returns false when version is nil'
do
latest_page
=
wiki
.
find_page
(
'Update'
,
nil
)
expect
(
latest_page
.
historical?
).
to
eq
false
end
end
private
private
def
remove_temp_repo
(
path
)
def
remove_temp_repo
(
path
)
...
...
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