Fix indentation of wiki menu item spec

pull/501/head
Till Breuer 11 years ago committed by Jens Ulferts
parent e1b9d6e742
commit 222756094c
  1. 100
      spec/models/wiki_menu_item_spec.rb

@ -29,71 +29,71 @@
require 'spec_helper' require 'spec_helper'
describe WikiMenuItem do describe WikiMenuItem do
before(:each) do before(:each) do
@project = FactoryGirl.create(:project, :enabled_module_names => %w[activity]) @project = FactoryGirl.create(:project, :enabled_module_names => %w[activity])
@current = FactoryGirl.create(:user, :login => "user1", :mail => "user1@users.com") @current = FactoryGirl.create(:user, :login => "user1", :mail => "user1@users.com")
User.stub(:current).and_return(@current) User.stub(:current).and_return(@current)
end end
it 'should create a default wiki menu item when enabling the wiki' do it 'should create a default wiki menu item when enabling the wiki' do
WikiMenuItem.all.should_not be_any WikiMenuItem.all.should_not be_any
@project.enabled_modules << EnabledModule.new(:name => 'wiki') @project.enabled_modules << EnabledModule.new(:name => 'wiki')
@project.reload @project.reload
wiki_item = @project.wiki.wiki_menu_items.first wiki_item = @project.wiki.wiki_menu_items.first
wiki_item.name.should eql 'Wiki' wiki_item.name.should eql 'Wiki'
wiki_item.title.should eql 'Wiki' wiki_item.title.should eql 'Wiki'
wiki_item.options[:index_page].should eql true wiki_item.options[:index_page].should eql true
wiki_item.options[:new_wiki_page].should eql true wiki_item.options[:new_wiki_page].should eql true
end end
it 'should change title when a wikipage is renamed' do it 'should change title when a wikipage is renamed' do
wikipage = FactoryGirl.create(:wiki_page, :title => 'Oldtitle') wikipage = FactoryGirl.create(:wiki_page, :title => 'Oldtitle')
menu_item_1 = FactoryGirl.create(:wiki_menu_item, :wiki_id => wikipage.wiki.id, menu_item_1 = FactoryGirl.create(:wiki_menu_item, :wiki_id => wikipage.wiki.id,
:name => 'Item 1', :name => 'Item 1',
:title => 'Oldtitle') :title => 'Oldtitle')
wikipage.title = 'Newtitle' wikipage.title = 'Newtitle'
wikipage.save! wikipage.save!
menu_item_1.reload menu_item_1.reload
menu_item_1.title.should == wikipage.title menu_item_1.title.should == wikipage.title
end end
describe 'it should destroy' do describe 'it should destroy' do
before(:each) do before(:each) do
@project.enabled_modules << EnabledModule.new(:name => 'wiki') @project.enabled_modules << EnabledModule.new(:name => 'wiki')
@project.reload @project.reload
@menu_item_1 = FactoryGirl.create(:wiki_menu_item, :wiki_id => @project.wiki.id, @menu_item_1 = FactoryGirl.create(:wiki_menu_item, :wiki_id => @project.wiki.id,
:name => 'Item 1', :name => 'Item 1',
:title => 'Item 1') :title => 'Item 1')
@menu_item_2 = FactoryGirl.create(:wiki_menu_item, :wiki_id => @project.wiki.id, @menu_item_2 = FactoryGirl.create(:wiki_menu_item, :wiki_id => @project.wiki.id,
:name => 'Item 2', :name => 'Item 2',
:parent_id => @menu_item_1.id, :parent_id => @menu_item_1.id,
:title => 'Item 2') :title => 'Item 2')
end end
it 'all children when deleting the parent' do it 'all children when deleting the parent' do
@menu_item_1.destroy @menu_item_1.destroy
expect {WikiMenuItem.find(@menu_item_1.id)}.to raise_error(ActiveRecord::RecordNotFound) expect {WikiMenuItem.find(@menu_item_1.id)}.to raise_error(ActiveRecord::RecordNotFound)
expect {WikiMenuItem.find(@menu_item_2.id)}.to raise_error(ActiveRecord::RecordNotFound) expect {WikiMenuItem.find(@menu_item_2.id)}.to raise_error(ActiveRecord::RecordNotFound)
end end
describe 'all items when destroying' do describe 'all items when destroying' do
it 'the associated project' do it 'the associated project' do
@project.destroy @project.destroy
WikiMenuItem.all.should_not be_any WikiMenuItem.all.should_not be_any
end end
it 'the associated wiki' do it 'the associated wiki' do
@project.wiki.destroy @project.wiki.destroy
WikiMenuItem.all.should_not be_any WikiMenuItem.all.should_not be_any
end end
end end
end end

Loading…
Cancel
Save