Skip to content
Snippets Groups Projects
Commit 109e8ef4 authored by Mark Fletcher's avatar Mark Fletcher
Browse files

Make WikiPage comparable according to StaticModel interface

* Add WikiPage#id method returning associated SHA for wiki page commit
parent 865e3fcc
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -207,6 +207,10 @@ class WikiPage
'projects/wikis/wiki_page'
end
 
def id
page.version.to_s
end
private
 
def set_attributes
Loading
Loading
Loading
Loading
@@ -318,6 +318,19 @@ describe WikiPage, models: true do
end
end
 
describe '#==' do
let(:original_wiki_page) { create(:wiki_page) }
it 'returns true for identical wiki page' do
expect(original_wiki_page).to eq(original_wiki_page)
end
it 'returns false for updated wiki page' do
updated_wiki_page = original_wiki_page.update("Updated content")
expect(original_wiki_page).not_to eq(updated_wiki_page)
end
end
private
 
def remove_temp_repo(path)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment