diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-01-27 11:42:31 -0200 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-01-29 14:17:00 -0200 |
commit | aa30088f6e02c761722d202bb741b7b51e9ec36e (patch) | |
tree | 21b090aae9c48e63849b8acd677de21167034e1b /spec/models/wiki_page_spec.rb | |
parent | b4b41b4ca6bc7cf41d0621dce670774f282f0873 (diff) | |
download | gitlab-ce-aa30088f6e02c761722d202bb741b7b51e9ec36e.tar.gz |
Fix old version warning when viewing wiki latest version via version_idfix-viewing-wiki-page-lastest-version-via-version-id
Diffstat (limited to 'spec/models/wiki_page_spec.rb')
-rw-r--r-- | spec/models/wiki_page_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb index c1b03838aa9..ddc49495eda 100644 --- a/spec/models/wiki_page_spec.rb +++ b/spec/models/wiki_page_spec.rb @@ -189,6 +189,38 @@ describe WikiPage, models: true do 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 def remove_temp_repo(path) |