Project

General

Profile

Patch #34643 » 0005-Changed-wiki-start_page-name-to-I18n-ed-field_start_.patch

Mischa The Evil, 2021-01-27 09:59

View differences:

app/models/enabled_module.rb
34 34
    when 'wiki'
35 35
      # Create a wiki with a default start page
36 36
      if project && project.wiki.nil?
37
        Wiki.create(:project => project, :start_page => 'Wiki')
37
        Wiki.create(:project => project,
38
                    :start_page => ll(Setting.default_language, :field_start_page))
38 39
      end
39 40
    end
40 41
  end
test/unit/enabled_module_test.rb
27 27
  end
28 28

  
29 29
  def test_enabling_wiki_should_create_a_wiki
30
    CustomField.delete_all
31
    project = Project.create!(:name => 'Project with wiki', :identifier => 'wikiproject', :enabled_module_names => [])
32
    assert_nil project.wiki
33
    project.enabled_module_names = ['wiki']
34
    project.reload
35
    assert_not_nil project.wiki
36
    assert_equal 'Wiki', project.wiki.start_page
30
    with_settings :default_language => 'en' do
31
      CustomField.delete_all
32
      project = Project.create!(:name => 'Project with wiki',
33
                                :identifier => 'wikiproject',
34
                                :enabled_module_names => [])
35
      assert_nil project.wiki
36
      project.enabled_module_names = ['wiki']
37
      project.reload
38
      assert_not_nil project.wiki
39
      assert_equal 'Start page', project.wiki.start_page
40
    end
37 41
  end
38 42

  
39 43
  def test_reenabling_wiki_should_not_create_another_wiki
(5-5/5)