From c09bb60a64040c0674fd94b50bda96523aeaf7e6 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Wed, 6 Feb 2008 14:55:03 +0000 Subject: [PATCH] ActionItem153: adding description attribute to Environment class --- app/models/environment.rb | 16 +++++++++++++++- test/unit/environment_test.rb | 7 +++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/models/environment.rb b/app/models/environment.rb index 8cbb3ab..f435e2a 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -31,7 +31,11 @@ class Environment < ActiveRecord::Base 3.times do env.boxes << Box.new end - env.boxes.first.blocks << MainBlock.new + env.boxes[0].blocks << MainBlock.new + + env.boxes[1].blocks << EnvironmentStatisticsBlock.new + env.boxes[1].blocks << RecentDocumentsBlock.new + end # One Environment can be reached by many domains @@ -142,6 +146,16 @@ class Environment < ActiveRecord::Base self.settings['organization_approval_method'] = actual_value end + # the description of the environment. Normally used in the homepage. + def description + self.settings[:description] + end + + # sets the #description of the environment + def description=(value) + self.settings[:description] = value + end + # ################################################# # Validations # ################################################# diff --git a/test/unit/environment_test.rb b/test/unit/environment_test.rb index 51338ac..c4600fd 100644 --- a/test/unit/environment_test.rb +++ b/test/unit/environment_test.rb @@ -240,4 +240,11 @@ class EnvironmentTest < Test::Unit::TestCase assert_equivalent [doc1,doc2,doc3], environment.recent_documents(3) end + should 'have a description attribute' do + env = Environment.new + + env.description = 'my fine environment' + assert_equal 'my fine environment', env.description + end + end -- libgit2 0.21.2