Destroy wiki after its last page has been deactivated and the wiki module has been successfully deactivated...

... This ensures a new menu item is spawned on reactivation of the wiki module. Moreover this is the raw state of a project without enabled wiki module.
pull/560/head
Till Breuer 11 years ago
parent 72693bdcc5
commit d779e8bae8
  1. 2
      app/models/wiki_page.rb
  2. 8
      spec/models/wiki_page_spec.rb

@ -76,7 +76,7 @@ class WikiPage < ActiveRecord::Base
after_destroy :delete_wiki_menu_item
after_destroy do |wiki_page|
wiki_page.wiki.project.disable_module(:wiki) if is_only_wiki_page?
wiki_page.wiki.project.disable_module(:wiki) and wiki_page.wiki.destroy if is_only_wiki_page?
end
def check_and_mark_as_protected

@ -63,6 +63,10 @@ describe WikiPage do
it 'deactivates the wiki module' do
project.module_enabled?(:wiki).should be_false
end
it 'destroys the project wiki' do
project.wiki.should be_nil
end
end
context 'when one of two wiki pages is destroyed' do
@ -75,6 +79,10 @@ describe WikiPage do
it 'does not deactivate the wiki module' do
project.module_enabled?(:wiki).should be_true
end
it 'does not destroy the project wiki' do
project.wiki.should be_present
end
end
end
end

Loading…
Cancel
Save