Merge pull request #350 from blmarket/pageauthor
Proper last edit info (with test case)
This commit is contained in:
@@ -14,13 +14,13 @@ module Precious
|
|||||||
end
|
end
|
||||||
|
|
||||||
def author
|
def author
|
||||||
return DEFAULT_AUTHOR unless @page.version
|
return DEFAULT_AUTHOR if @page.versions.empty?
|
||||||
@page.version.author.name
|
@page.versions[0].author.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def date
|
def date
|
||||||
return Time.now.strftime(DATE_FORMAT) unless @page.version
|
return Time.now.strftime(DATE_FORMAT) if @page.versions.empty?
|
||||||
@page.version.authored_date.strftime(DATE_FORMAT)
|
@page.versions[0].authored_date.strftime(DATE_FORMAT)
|
||||||
end
|
end
|
||||||
|
|
||||||
def editable
|
def editable
|
||||||
|
|||||||
+17
-1
@@ -15,7 +15,23 @@ context "Frontend" do
|
|||||||
FileUtils.rm_rf(@path)
|
FileUtils.rm_rf(@path)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "edits page" do
|
test "committer remains same if page didn't modified" do
|
||||||
|
@wiki.write_page('CC', :markdown, 'asdf',
|
||||||
|
{ :name => "asdf", :email => "news@nomail.com" });
|
||||||
|
|
||||||
|
get '/CC'
|
||||||
|
assert_match /Last edited by <b>asdf/, last_response.body
|
||||||
|
|
||||||
|
@wiki.write_page('DD', :markdown, 'asdf',
|
||||||
|
{ :name => "news", :email => "asdf@nomail.com" });
|
||||||
|
|
||||||
|
get '/DD'
|
||||||
|
assert_match /Last edited by <b>news/, last_response.body
|
||||||
|
get '/CC'
|
||||||
|
assert_match /Last edited by <b>asdf/, last_response.body
|
||||||
|
end
|
||||||
|
|
||||||
|
test "edits page" do
|
||||||
page_1 = @wiki.page('A')
|
page_1 = @wiki.page('A')
|
||||||
post "/edit/A", :content => 'abc',
|
post "/edit/A", :content => 'abc',
|
||||||
:format => page_1.format, :message => 'def'
|
:format => page_1.format, :message => 'def'
|
||||||
|
|||||||
Reference in New Issue
Block a user