summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/contexts/projects/create_context.rb3
-rw-r--r--config/gitlab.yml.example1
-rw-r--r--config/initializers/1_settings.rb1
-rw-r--r--spec/contexts/projects_create_context_spec.rb28
4 files changed, 32 insertions, 1 deletions
diff --git a/app/contexts/projects/create_context.rb b/app/contexts/projects/create_context.rb
index 1ee3e459074..9fd24e0eeea 100644
--- a/app/contexts/projects/create_context.rb
+++ b/app/contexts/projects/create_context.rb
@@ -16,7 +16,8 @@ module Projects
wiki_enabled: default_features.wiki,
wall_enabled: default_features.wall,
snippets_enabled: default_features.snippets,
- merge_requests_enabled: default_features.merge_requests
+ merge_requests_enabled: default_features.merge_requests,
+ public: default_features.public
}
@project = Project.new(default_opts.merge(params))
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
index 389dba59c9d..99a23db0f1e 100644
--- a/config/gitlab.yml.example
+++ b/config/gitlab.yml.example
@@ -58,6 +58,7 @@ production: &base
wiki: true
wall: false
snippets: false
+ public: false
## External issues trackers
issues_tracker:
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index b3a19783b14..da7a83a62a4 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -75,6 +75,7 @@ Settings.gitlab.default_projects_features['merge_requests'] = true if Settings.g
Settings.gitlab.default_projects_features['wiki'] = true if Settings.gitlab.default_projects_features['wiki'].nil?
Settings.gitlab.default_projects_features['wall'] = false if Settings.gitlab.default_projects_features['wall'].nil?
Settings.gitlab.default_projects_features['snippets'] = false if Settings.gitlab.default_projects_features['snippets'].nil?
+Settings.gitlab.default_projects_features['public'] = false if Settings.gitlab.default_projects_features['public'].nil?
#
# Gravatar
diff --git a/spec/contexts/projects_create_context_spec.rb b/spec/contexts/projects_create_context_spec.rb
index dd10dd3ede8..3cabec283d7 100644
--- a/spec/contexts/projects_create_context_spec.rb
+++ b/spec/contexts/projects_create_context_spec.rb
@@ -30,6 +30,34 @@ describe Projects::CreateContext do
it { @project.owner.should == @user }
it { @project.namespace.should == @group }
end
+
+ context 'respect configured public setting' do
+ before(:each) do
+ @settings = double("settings")
+ @settings.stub(:issues) { true }
+ @settings.stub(:merge_requests) { true }
+ @settings.stub(:wiki) { true }
+ @settings.stub(:wall) { true }
+ @settings.stub(:snippets) { true }
+ stub_const("Settings", Class.new)
+ Settings.stub_chain(:gitlab, :default_projects_features).and_return(@settings)
+ end
+ context 'should be public when setting is public' do
+ before do
+ @settings.stub(:public) { true }
+ @project = create_project(@user, @opts)
+ end
+ it { @project.public.should be_true }
+ end
+ context 'should be private when setting is not public' do
+ before do
+ @settings.stub(:public) { false }
+ @project = create_project(@user, @opts)
+ end
+ it { @project.public.should be_false }
+ end
+
+ end
end
def create_project(user, opts)