Commit 5281e384424cdf2c2e98843b98a7eecdd6c0fa1e

Authored by AntonioTerceiro
1 parent ee6aa672

ActionItem68: s/Virtual Community/Environment/




git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@512 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/application.rb
... ... @@ -4,7 +4,7 @@ class ApplicationController < ActionController::Base
4 4  
5 5 helper :document
6 6  
7   - design :holder => 'virtual_community'
  7 + design :holder => 'environment'
8 8  
9 9 # Be sure to include AuthenticationSystem in Application Controller instead
10 10 include AuthenticatedSystem
... ... @@ -12,7 +12,7 @@ class ApplicationController < ActionController::Base
12 12 init_gettext 'noosfero'
13 13  
14 14 before_filter :detect_stuff_by_domain
15   - attr_reader :virtual_community
  15 + attr_reader :environment
16 16  
17 17 protected
18 18  
... ... @@ -20,9 +20,9 @@ class ApplicationController < ActionController::Base
20 20 def detect_stuff_by_domain
21 21 @domain = Domain.find_by_name(request.host)
22 22 if @domain.nil?
23   - @virtual_community = VirtualCommunity.default
  23 + @environment = Environment.default
24 24 else
25   - @virtual_community = @domain.virtual_community
  25 + @environment = @domain.environment
26 26 @profile = @domain.profile
27 27 end
28 28 end
... ... @@ -38,7 +38,7 @@ class ApplicationController < ActionController::Base
38 38 @profile
39 39 end
40 40  
41   - def self.acts_as_virtual_community_admin_controller
  41 + def self.acts_as_environment_admin_controller
42 42 before_filter :load_admin_controller
43 43 end
44 44 def load_admin_controller
... ...
app/controllers/environment_admin/edit_template_controller.rb
1 1 class EditTemplateController < EnvironmentAdminController
2 2  
3   - design_editor :holder => 'virtual_community', :autosave => true, :block_types => :block_types
  3 + design_editor :holder => 'environment', :autosave => true, :block_types => :block_types
4 4  
5 5 def block_types
6 6 {
... ...
app/controllers/environment_admin/features_controller.rb
1 1 class FeaturesController < EnvironmentAdminController
2 2  
3   - acts_as_virtual_community_admin_controller
  3 + acts_as_environment_admin_controller
4 4  
5 5 def index
6   - @features = VirtualCommunity.available_features
  6 + @features = Environment.available_features
7 7 end
8 8  
9 9 post_only :update
... ... @@ -13,8 +13,8 @@ class FeaturesController &lt; EnvironmentAdminController
13 13 else
14 14 params[:features].keys
15 15 end
16   - @virtual_community.enabled_features = features
17   - @virtual_community.save!
  16 + @environment.enabled_features = features
  17 + @environment.save!
18 18 flash[:notice] = _('Features updated successfully.')
19 19 redirect_to :action => 'index'
20 20 end
... ...
app/controllers/profile_admin/enterprise_controller.rb
... ... @@ -11,7 +11,7 @@ class EnterpriseController &lt; ProfileAdminController
11 11 else
12 12 redirect_to :action => 'list'
13 13 end
14   - @vitual_communities = VirtualCommunity.find(:all)
  14 + @vitual_communities = Environment.find(:all)
15 15 @validation_entities = Organization.find(:all)
16 16 end
17 17  
... ... @@ -28,7 +28,7 @@ class EnterpriseController &lt; ProfileAdminController
28 28 # Make a form to the creation of an eterprise
29 29 def register_form
30 30 @enterprise = Enterprise.new()
31   - @vitual_communities = VirtualCommunity.find(:all)
  31 + @vitual_communities = Environment.find(:all)
32 32 @validation_entities = Organization.find(:all)
33 33 end
34 34  
... ... @@ -42,7 +42,7 @@ class EnterpriseController &lt; ProfileAdminController
42 42 redirect_to :action => 'index'
43 43 else
44 44 flash[:notice] = _('Enterprise was not created')
45   - @vitual_communities = VirtualCommunity.find(:all)
  45 + @vitual_communities = Environment.find(:all)
46 46 @validation_entities = Organization.find(:all)
47 47 render :action => 'register_form'
48 48 end
... ...
app/controllers/public/account_controller.rb
... ... @@ -27,12 +27,12 @@ class AccountController &lt; PublicController
27 27 def signup
28 28 begin
29 29 @user = User.new(params[:user])
30   - @user.terms_of_use = virtual_community.terms_of_use
31   - @terms_of_use = virtual_community.terms_of_use
  30 + @user.terms_of_use = environment.terms_of_use
  31 + @terms_of_use = environment.terms_of_use
32 32  
33 33 if request.post?
34 34 @user.save!
35   - @user.person.virtual_community = virtual_community
  35 + @user.person.environment = environment
36 36 @user.person.save!
37 37 self.current_user = @user
38 38 redirect_back_or_default(:controller => 'account', :action => 'index')
... ...
app/controllers/public/home_controller.rb
1 1 class HomeController < PublicController
2 2  
3   - design :holder => 'virtual_community'
  3 + design :holder => 'environment'
4 4  
5 5 end
... ...
app/helpers/application_helper.rb
... ... @@ -73,8 +73,8 @@ module ApplicationHelper
73 73 # TODO: test this helper
74 74 # TODO: add an icon?
75 75 # TODO: the command rake test:rcov didn't works because of this method. See what it's the problem
76   - def virtual_community_identification
77   - content_tag('div', @virtual_community.name, :id => 'virtual_community_identification')
  76 + def environment_identification
  77 + content_tag('div', @environment.name, :id => 'environment_identification')
78 78 end
79 79  
80 80 def link_to_cms(text, profile = nil, options = {})
... ...
app/models/domain.rb
... ... @@ -40,15 +40,15 @@ class Domain &lt; ActiveRecord::Base
40 40 name.downcase.sub(/^www\./, '')
41 41 end
42 42  
43   - # detects the VirtualCommunity to which this domain belongs, either if it's
  43 + # detects the Environment to which this domain belongs, either if it's
44 44 # directly owned by one, or through a profile who owns the domain but belongs
45   - # to a VirtualCommunity.
46   - def virtual_community
  45 + # to a Environment.
  46 + def environment
47 47 case owner
48   - when VirtualCommunity
  48 + when Environment
49 49 owner
50 50 when Profile
51   - owner.virtual_community
  51 + owner.environment
52 52 end
53 53 end
54 54  
... ... @@ -56,7 +56,7 @@ class Domain &lt; ActiveRecord::Base
56 56 # not directly associated with a profile.
57 57 def profile
58 58 case owner
59   - when VirtualCommunity
  59 + when Environment
60 60 nil
61 61 when Profile
62 62 owner
... ...
app/models/profile.rb
1 1 # A Profile is the representation and web-presence of an individual or an
2   -# organization. Every Profile is attached to its VirtualCommunity of origin,
3   -# which by default is the one returned by VirtualCommunity:default.
  2 +# organization. Every Profile is attached to its Environment of origin,
  3 +# which by default is the one returned by Environment:default.
4 4 class Profile < ActiveRecord::Base
5 5  
6 6 after_create do |profile|
... ... @@ -32,7 +32,7 @@ class Profile &lt; ActiveRecord::Base
32 32 acts_as_taggable
33 33  
34 34 has_many :domains, :as => :owner
35   - belongs_to :virtual_community
  35 + belongs_to :environment
36 36  
37 37 has_many :role_assignments, :as => :resource
38 38 has_many :people, :through => :role_assignments
... ... @@ -56,11 +56,11 @@ class Profile &lt; ActiveRecord::Base
56 56 validates_uniqueness_of :user_id, :allow_nil =>true
57 57  
58 58 # creates a new Profile. By default, it is attached to the default
59   - # VirtualCommunity (see VirtualCommunity#default), unless you tell it
  59 + # Environment (see Environment#default), unless you tell it
60 60 # otherwise
61 61 def initialize(*args)
62 62 super(*args)
63   - self.virtual_community ||= VirtualCommunity.default
  63 + self.environment ||= Environment.default
64 64 end
65 65  
66 66 # Searches tags by tag or name
... ...
app/models/virtual_community.rb
1   -# A VirtualCommunity is like a website to be hosted in the platform. It may
  1 +# A Environment is like a website to be hosted in the platform. It may
2 2 # contain multiple Profile's and can be identified by several different
3 3 # domains.
4   -class VirtualCommunity < ActiveRecord::Base
  4 +class Environment < ActiveRecord::Base
5 5  
6   - # returns the available features for a VirtualCommunity, in the form of a
  6 + # returns the available features for a Environment, in the form of a
7 7 # hash, with pairs in the form <tt>'feature_name' => 'Feature name'</tt>.
8 8 def self.available_features
9 9 {
... ... @@ -18,7 +18,7 @@ class VirtualCommunity &lt; ActiveRecord::Base
18 18  
19 19 acts_as_design
20 20  
21   - # One VirtualCommunity can be reached by many domains
  21 + # One Environment can be reached by many domains
22 22 has_many :domains, :as => :owner
23 23 has_many :profiles
24 24  
... ... @@ -26,10 +26,10 @@ class VirtualCommunity &lt; ActiveRecord::Base
26 26 # Attributes
27 27 # #################################################
28 28  
29   - # store the VirtualCommunity settings as YAML-serialized Hash.
  29 + # store the Environment settings as YAML-serialized Hash.
30 30 serialize :settings
31 31  
32   - # returns a Hash containing the VirtualCommunity configuration
  32 + # returns a Hash containing the Environment configuration
33 33 def settings
34 34 self[:settings] ||= {}
35 35 end
... ... @@ -74,7 +74,7 @@ class VirtualCommunity &lt; ActiveRecord::Base
74 74 self.settings['terms_of_use'] = value
75 75 end
76 76  
77   - # returns <tt>true</tt> if this VirtualCommunity has terms of use to be
  77 + # returns <tt>true</tt> if this Environment has terms of use to be
78 78 # accepted by users before registration.
79 79 def has_terms_of_use?
80 80 ! self.settings['terms_of_use'].nil?
... ... @@ -118,13 +118,13 @@ class VirtualCommunity &lt; ActiveRecord::Base
118 118 validates_presence_of :name
119 119  
120 120 # only one virtual community can be the default one
121   - validates_uniqueness_of :is_default, :if => (lambda do |virtual_community| virtual_community.is_default? end), :message => _('Only one Virtual Community can be the default one')
  121 + validates_uniqueness_of :is_default, :if => (lambda do |environment| environment.is_default? end), :message => _('Only one Virtual Community can be the default one')
122 122  
123 123 # #################################################
124 124 # Business logic in general
125 125 # #################################################
126 126  
127   - # the default VirtualCommunity.
  127 + # the default Environment.
128 128 def self.default
129 129 self.find(:first, :conditions => [ 'is_default = ?', true ] )
130 130 end
... ...
app/views/features/_features_table.rhtml
... ... @@ -3,7 +3,7 @@
3 3 <% @features.each do |feature, text| %>
4 4 <tr>
5 5 <td><%= text %></td>
6   - <td><%= check_box_tag "features[#{feature}]", '1', @virtual_community.enabled?(feature) %></td>
  6 + <td><%= check_box_tag "features[#{feature}]", '1', @environment.enabled?(feature) %></td>
7 7 </tr>
8 8 <% end %>
9 9 <tr><td colspan='2'><%= submit_tag _('Save changes') %></td></tr>
... ...
app/views/home/index.rhtml
1 1 <%= flash[:notice] %>
2   -Start page of Virtual Community <%= @virtual_community.name %>
  2 +Start page of Virtual Community <%= @environment.name %>
3 3  
... ...
config/environment.rb
... ... @@ -82,17 +82,17 @@ Comatose.configure do |config|
82 82 config.admin_helpers << :application_helper
83 83 config.admin_helpers << :document_helper
84 84 end
85   -Comatose::AdminController.design :holder => 'virtual_community'
  85 +Comatose::AdminController.design :holder => 'environment'
86 86 Comatose::AdminController.before_filter do |controller|
87 87 # TODO: copy/paste; extract this into a method (see
88 88 # app/controllers/application.rb)
89 89 domain = Domain.find_by_name(controller.request.host)
90 90 if domain.nil?
91   - virtual_community = VirtualCommunity.default
  91 + environment = Environment.default
92 92 else
93   - virtual_community = domain.virtual_community
  93 + environment = domain.environment
94 94 profile = domain.profile
95 95 end
96   - controller.instance_variable_set('@virtual_community', virtual_community)
  96 + controller.instance_variable_set('@environment', environment)
97 97 end
98 98  
... ...
db/migrate/002_create_virtual_communities.rb
1   -class CreateVirtualCommunities < ActiveRecord::Migration
  1 +class CreateEnvironments < ActiveRecord::Migration
2 2 def self.up
3   - create_table :virtual_communities do |t|
  3 + create_table :environments do |t|
4 4 t.column :name, :string
5 5 t.column :is_default, :boolean
6 6 t.column :settings, :text
7 7 t.column :design_data, :text
8 8 end
9   - VirtualCommunity.create!(:name => 'Default Virtual Community', :is_default => true)
  9 + Environment.create!(:name => 'Default Environment', :is_default => true)
10 10 end
11 11  
12 12 def self.down
... ...
db/migrate/003_create_profiles.rb
... ... @@ -4,7 +4,7 @@ class CreateProfiles &lt; ActiveRecord::Migration
4 4 t.column :name, :string
5 5 t.column :type, :string
6 6 t.column :identifier, :string
7   - t.column :virtual_community_id, :integer
  7 + t.column :environment_id, :integer
8 8 t.column :flexible_template_template, :string, :default => "default"
9 9 t.column :flexible_template_theme, :string, :default => "default"
10 10 t.column :flexible_template_icon_theme, :string, :default => "default"
... ...
po/noosfero.pot
... ... @@ -226,35 +226,35 @@ msgstr &quot;&quot;
226 226 msgid "PersonInfo|Contact information"
227 227 msgstr ""
228 228  
229   -#: app/models/virtual_community.rb:-
  229 +#: app/models/environment.rb:-
230 230 msgid "virtual community"
231 231 msgstr ""
232 232  
233   -#: app/models/virtual_community.rb:-
234   -msgid "VirtualCommunity|Name"
  233 +#: app/models/environment.rb:-
  234 +msgid "Environment|Name"
235 235 msgstr ""
236 236  
237   -#: app/models/virtual_community.rb:-
238   -msgid "VirtualCommunity|Is default"
  237 +#: app/models/environment.rb:-
  238 +msgid "Environment|Is default"
239 239 msgstr ""
240 240  
241   -#: app/models/virtual_community.rb:-
242   -msgid "VirtualCommunity|Settings"
  241 +#: app/models/environment.rb:-
  242 +msgid "Environment|Settings"
243 243 msgstr ""
244 244  
245   -#: app/models/virtual_community.rb:-
246   -msgid "VirtualCommunity|Design data"
  245 +#: app/models/environment.rb:-
  246 +msgid "Environment|Design data"
247 247 msgstr ""
248 248  
249   -#: app/models/virtual_community.rb:10
  249 +#: app/models/environment.rb:10
250 250 msgid "Some feature"
251 251 msgstr ""
252 252  
253   -#: app/models/virtual_community.rb:11
  253 +#: app/models/environment.rb:11
254 254 msgid "Other feature"
255 255 msgstr ""
256 256  
257   -#: app/models/virtual_community.rb:121
  257 +#: app/models/environment.rb:121
258 258 msgid "Only one Virtual Community can be the default one"
259 259 msgstr ""
260 260  
... ...
po/pt_BR/noosfero.po
... ... @@ -228,35 +228,35 @@ msgstr &quot;Endereço&quot;
228 228 msgid "PersonInfo|Contact information"
229 229 msgstr "Informação de contato"
230 230  
231   -#: app/models/virtual_community.rb:-
  231 +#: app/models/environment.rb:-
232 232 msgid "virtual community"
233 233 msgstr "comunidade virtual"
234 234  
235   -#: app/models/virtual_community.rb:-
236   -msgid "VirtualCommunity|Name"
  235 +#: app/models/environment.rb:-
  236 +msgid "Environment|Name"
237 237 msgstr "Nome"
238 238  
239   -#: app/models/virtual_community.rb:-
240   -msgid "VirtualCommunity|Is default"
  239 +#: app/models/environment.rb:-
  240 +msgid "Environment|Is default"
241 241 msgstr "É padrão"
242 242  
243   -#: app/models/virtual_community.rb:-
244   -msgid "VirtualCommunity|Settings"
  243 +#: app/models/environment.rb:-
  244 +msgid "Environment|Settings"
245 245 msgstr "Configurações"
246 246  
247   -#: app/models/virtual_community.rb:-
248   -msgid "VirtualCommunity|Design data"
  247 +#: app/models/environment.rb:-
  248 +msgid "Environment|Design data"
249 249 msgstr "Dados de design"
250 250  
251   -#: app/models/virtual_community.rb:10
  251 +#: app/models/environment.rb:10
252 252 msgid "Some feature"
253 253 msgstr "Alguma funcionalidade"
254 254  
255   -#: app/models/virtual_community.rb:11
  255 +#: app/models/environment.rb:11
256 256 msgid "Other feature"
257 257 msgstr "Outra funcionalidade"
258 258  
259   -#: app/models/virtual_community.rb:121
  259 +#: app/models/environment.rb:121
260 260 msgid "Only one Virtual Community can be the default one"
261 261 msgstr "Apenas uma comunidade virtual pode ser a padrão"
262 262  
... ...
public/artwork/newbar/menu.html
... ... @@ -90,7 +90,7 @@
90 90 </div><!-- id="noosfero_bar" -->
91 91  
92 92 <div id="header">
93   - <div id="virtual_community_identification">Default Virtual Community</div>
  93 + <div id="environment_identification">Default Virtual Community</div>
94 94 </div>
95 95  
96 96 <div id='content'>
... ...
public/artwork/tmp/bar.html
... ... @@ -50,7 +50,7 @@
50 50 </div>
51 51  
52 52 <div id="header">
53   - <div id="virtual_community_identification">Default Virtual Community</div>
  53 + <div id="environment_identification">Default Virtual Community</div>
54 54 <div id="user_links">
55 55 <span id="login_name">Login Name</span><br />
56 56 <a href="#" id="perfil_edit_button">Editar Perfil</a>|<a href="#" id="logout_button">Sair</a>
... ...
public/artwork/tmp/stylesheets/blue_bar.css
... ... @@ -33,7 +33,7 @@
33 33 color: #ffffff;
34 34 }
35 35  
36   -#virtual_community_identification {
  36 +#environment_identification {
37 37 float: left;
38 38 background: url("../images/bg_blue_logo.png") left bottom no-repeat;
39 39 vertical-align: bottom;
... ...
public/stylesheets/common.css
... ... @@ -22,7 +22,7 @@ a:hover img {
22 22  
23 23 /* Bar Blue Default */
24 24  
25   -#virtual_community_identification {
  25 +#environment_identification {
26 26 position: absolute !important;
27 27 background: url("../images/bg_blue_logo.png") 5px no-repeat !important;
28 28 vertical-align: bottom !important ;
... ... @@ -32,7 +32,7 @@ line-height: 34px !important ;
32 32 padding-left: 60px !important ;
33 33 }
34 34  
35   -#virtual_community_identification:hover {
  35 +#environment_identification:hover {
36 36 color: #dfdfdf !important ;
37 37 }
38 38  
... ...
test/fixtures/domains.yml
... ... @@ -2,12 +2,12 @@
2 2 one:
3 3 id: 1
4 4 name: colivre.net
5   - owner_type: VirtualCommunity
  5 + owner_type: Environment
6 6 owner_id: 1
7 7 two:
8 8 id: 2
9 9 name: anhetegua.net
10   - owner_type: VirtualCommunity
  10 + owner_type: Environment
11 11 owner_id: 2
12 12 three:
13 13 id: 3
... ...
test/fixtures/profiles.yml
... ... @@ -4,7 +4,7 @@ johndoe:
4 4 name: 'John Doe'
5 5 type: 'Person'
6 6 identifier: johndoe
7   - virtual_community_id: 1
  7 + environment_id: 1
8 8 user_id: 1
9 9 flexible_template_template: 'default'
10 10 flexible_template_icon_theme: 'default'
... ... @@ -14,7 +14,7 @@ joerandomhacker:
14 14 name: 'Joe Random Hacker'
15 15 type: 'Person'
16 16 identifier: joerandomhacker
17   - virtual_community_id: 1
  17 + environment_id: 1
18 18 user_id: 2
19 19 flexible_template_template: 'simple'
20 20 flexible_template_icon_theme: 'simple'
... ... @@ -24,7 +24,7 @@ john_and_joe:
24 24 name: "John and Joe's Production Cooperative"
25 25 type: 'Person'
26 26 identifier: john_and_joe
27   - virtual_community_id: 1
  27 + environment_id: 1
28 28 flexible_template_template: 'simple'
29 29 flexible_template_icon_theme: 'simple'
30 30 flexible_template_theme: 'simple'
... ... @@ -34,7 +34,7 @@ ze:
34 34 type: 'Person'
35 35 user_id: 3
36 36 identifier: ze
37   - virtual_community_id: 1
  37 + environment_id: 1
38 38 flexible_template_template: 'default'
39 39 flexible_template_icon_theme: 'default'
40 40 flexible_template_theme: 'default'
... ... @@ -43,7 +43,7 @@ colivre:
43 43 name: "cooptec_livre"
44 44 type: 'Enterprise'
45 45 identifier: 'colivre'
46   - virtual_community_id: 1
  46 + environment_id: 1
47 47 flexible_template_template: 'default'
48 48 flexible_template_icon_theme: 'default'
49 49 flexible_template_theme: 'default'
... ... @@ -52,7 +52,7 @@ empreendimentoB:
52 52 name: "emp B"
53 53 type: 'Enterprise'
54 54 identifier: "empb"
55   - virtual_community_id: 1
  55 + environment_id: 1
56 56 flexible_template_template: 'default'
57 57 flexible_template_icon_theme: 'default'
58 58 flexible_template_theme: 'default'
... ...
test/functional/account_controller_test.rb
... ... @@ -70,7 +70,7 @@ class AccountControllerTest &lt; Test::Unit::TestCase
70 70  
71 71 def test_shoud_not_save_without_acceptance_of_terms_of_use_on_signup
72 72 assert_no_difference User, :count do
73   - VirtualCommunity.default.update_attributes(:terms_of_use => 'some terms ...')
  73 + Environment.default.update_attributes(:terms_of_use => 'some terms ...')
74 74 create_user
75 75 assert_response :success
76 76 end
... ... @@ -78,7 +78,7 @@ class AccountControllerTest &lt; Test::Unit::TestCase
78 78  
79 79 def test_shoud_save_with_acceptance_of_terms_of_use_on_signup
80 80 assert_difference User, :count do
81   - VirtualCommunity.default.update_attributes(:terms_of_use => 'some terms ...')
  81 + Environment.default.update_attributes(:terms_of_use => 'some terms ...')
82 82 create_user(:terms_accepted => '1')
83 83 assert_response :redirect
84 84 end
... ...
test/functional/application_controller_test.rb
... ... @@ -14,9 +14,9 @@ class ApplicationControllerTest &lt; Test::Unit::TestCase
14 14 @response = ActionController::TestResponse.new
15 15 end
16 16  
17   - def test_exist_virtual_community_variable_to_helper_virtual_community_identification
  17 + def test_exist_environment_variable_to_helper_environment_identification
18 18 get :index
19   - assert_not_nil assigns(:virtual_community)
  19 + assert_not_nil assigns(:environment)
20 20 end
21 21  
22 22 def test_get_against_post_only
... ...
test/functional/features_controller_test.rb
... ... @@ -18,7 +18,7 @@ class FeaturesControllerTest &lt; Test::Unit::TestCase
18 18 uses_host 'anhetegua.net'
19 19 get :index
20 20 assert_template 'index'
21   - VirtualCommunity.available_features.each do |feature, text|
  21 + Environment.available_features.each do |feature, text|
22 22 assert_tag(:tag => 'input', :attributes => { :type => 'checkbox', :name => "features[#{feature}]" })
23 23 end
24 24 end
... ... @@ -28,7 +28,7 @@ class FeaturesControllerTest &lt; Test::Unit::TestCase
28 28 post :update, :features => { 'feature1' => '1', 'feature2' => '1' }
29 29 assert_redirected_to :action => 'index'
30 30 assert_kind_of String, flash[:notice]
31   - v = VirtualCommunity.find(virtual_communities(:anhetegua_net).id)
  31 + v = Environment.find(virtual_communities(:anhetegua_net).id)
32 32 assert v.enabled?('feature2')
33 33 assert v.enabled?('feature2')
34 34 assert !v.enabled?('feature3')
... ... @@ -39,7 +39,7 @@ class FeaturesControllerTest &lt; Test::Unit::TestCase
39 39 post :update # no features
40 40 assert_redirected_to :action => 'index'
41 41 assert_kind_of String, flash[:notice]
42   - v = VirtualCommunity.find(virtual_communities(:anhetegua_net).id)
  42 + v = Environment.find(virtual_communities(:anhetegua_net).id)
43 43 assert !v.enabled?('feature1')
44 44 assert !v.enabled?('feature2')
45 45 assert !v.enabled?('feature3')
... ...
test/functional/home_controller_test.rb
... ... @@ -14,12 +14,12 @@ class HomeControllerTest &lt; Test::Unit::TestCase
14 14 @response = ActionController::TestResponse.new
15 15 end
16 16  
17   - def test_detection_of_virtual_community_by_host
  17 + def test_detection_of_environment_by_host
18 18 uses_host 'www.colivre.net'
19 19 get :index
20 20 assert_template 'index'
21 21  
22   - assert_kind_of VirtualCommunity, assigns(:virtual_community)
  22 + assert_kind_of Environment, assigns(:environment)
23 23  
24 24 assert_kind_of Domain, assigns(:domain)
25 25 assert_equal 'colivre.net', assigns(:domain).name
... ... @@ -32,7 +32,7 @@ class HomeControllerTest &lt; Test::Unit::TestCase
32 32 get :index
33 33 assert_template 'index'
34 34  
35   - assert_kind_of VirtualCommunity, assigns(:virtual_community)
  35 + assert_kind_of Environment, assigns(:environment)
36 36  
37 37 assert_kind_of Domain, assigns(:domain)
38 38 assert_equal 'jrh.net', assigns(:domain).name
... ... @@ -40,14 +40,14 @@ class HomeControllerTest &lt; Test::Unit::TestCase
40 40 assert_kind_of Profile, assigns(:profile)
41 41 end
42 42  
43   - def test_unknown_domain_falls_back_to_default_virtual_community
  43 + def test_unknown_domain_falls_back_to_default_environment
44 44 uses_host 'veryunprobabledomain.com'
45 45  
46 46 get :index
47 47 assert_template 'index'
48 48  
49   - assert_kind_of VirtualCommunity, assigns(:virtual_community)
50   - assert assigns(:virtual_community).is_default?
  49 + assert_kind_of Environment, assigns(:environment)
  50 + assert assigns(:environment).is_default?
51 51  
52 52 end
53 53  
... ...
test/integration/signup_test.rb
... ... @@ -4,7 +4,7 @@ class AccountTest &lt; ActionController::IntegrationTest
4 4 fixtures :users, :profiles, :domains, :virtual_communities
5 5  
6 6 def test_should_require_acceptance_of_terms_for_signup
7   - VirtualCommunity.default.update_attributes(:terms_of_use => 'You agree that from now on your soul belongs to us.')
  7 + Environment.default.update_attributes(:terms_of_use => 'You agree that from now on your soul belongs to us.')
8 8  
9 9 count = User.count
10 10  
... ...
test/mocks/test/virtual_community.rb
1   -require File.expand_path(File.dirname(__FILE__) + "/../../../app/models/virtual_community")
  1 +require File.expand_path(File.dirname(__FILE__) + "/../../../app/models/environment")
2 2  
3   -class VirtualCommunity < ActiveRecord::Base
  3 +class Environment < ActiveRecord::Base
4 4 def self.available_features
5 5 {
6 6 'feature1' => 'Enable Feature 1',
... ...
test/unit/domain_test.rb
... ... @@ -24,9 +24,9 @@ class DomainTest &lt; Test::Unit::TestCase
24 24  
25 25 def test_owner
26 26 d = Domain.new(:name => 'example.com')
27   - d.owner = VirtualCommunity.new(:name => 'Example')
  27 + d.owner = Environment.new(:name => 'Example')
28 28 assert d.save
29   - assert_kind_of VirtualCommunity, d.owner
  29 + assert_kind_of Environment, d.owner
30 30 end
31 31  
32 32 def test_get_domain_name
... ... @@ -64,22 +64,22 @@ class DomainTest &lt; Test::Unit::TestCase
64 64 assert d.errors.invalid?(:name)
65 65 end
66 66  
67   - def test_virtual_community
68   - # domain directly linked to VirtualCommunity
  67 + def test_environment
  68 + # domain directly linked to Environment
69 69 domain = Domain.find_by_name('colivre.net')
70   - assert_kind_of VirtualCommunity, domain.owner
71   - assert_kind_of VirtualCommunity, domain.virtual_community
  70 + assert_kind_of Environment, domain.owner
  71 + assert_kind_of Environment, domain.environment
72 72  
73 73 # domain linked to Profile
74 74 domain = Domain.find_by_name('johndoe.net')
75 75 assert_kind_of Profile, domain.owner
76   - assert_kind_of VirtualCommunity, domain.virtual_community
  76 + assert_kind_of Environment, domain.environment
77 77 end
78 78  
79 79 def test_profile
80 80 # domain linked to profile
81 81 assert_not_nil Domain.find_by_name('johndoe.net').profile
82   - # domain linked to VirtualCommunity
  82 + # domain linked to Environment
83 83 assert_nil Domain.find_by_name('colivre.net').profile
84 84 end
85 85  
... ...
test/unit/enterprise_test.rb
... ... @@ -34,9 +34,9 @@ class EnterpriseTest &lt; Test::Unit::TestCase
34 34 assert_kind_of Array, p.domains
35 35 end
36 36  
37   - def test_belongs_to_virtual_community_and_has_default
  37 + def test_belongs_to_environment_and_has_default
38 38 p = Enterprise.new
39   - assert_kind_of VirtualCommunity, p.virtual_community
  39 + assert_kind_of Environment, p.environment
40 40 end
41 41  
42 42 def test_cannot_rename
... ...
test/unit/profile_test.rb
... ... @@ -34,9 +34,9 @@ class ProfileTest &lt; Test::Unit::TestCase
34 34 assert_kind_of Array, p.domains
35 35 end
36 36  
37   - def test_belongs_to_virtual_community_and_has_default
  37 + def test_belongs_to_environment_and_has_default
38 38 p = Profile.new
39   - assert_kind_of VirtualCommunity, p.virtual_community
  39 + assert_kind_of Environment, p.environment
40 40 end
41 41  
42 42 def test_cannot_rename
... ...
test/unit/virtual_community_test.rb
1 1 require File.dirname(__FILE__) + '/../test_helper'
2 2  
3   -class VirtualCommunityTest < Test::Unit::TestCase
  3 +class EnvironmentTest < Test::Unit::TestCase
4 4 fixtures :virtual_communities
5 5  
6 6 def test_exists_default_and_it_is_unique
7   - VirtualCommunity.delete_all
8   - vc = VirtualCommunity.new(:name => 'Test Community')
  7 + Environment.delete_all
  8 + vc = Environment.new(:name => 'Test Community')
9 9 vc.is_default = true
10 10 assert vc.save
11 11  
12   - vc2 = VirtualCommunity.new(:name => 'Another Test Community')
  12 + vc2 = Environment.new(:name => 'Another Test Community')
13 13 vc2.is_default = true
14 14 assert !vc2.valid?
15 15 assert vc2.errors.invalid?(:is_default)
16 16  
17   - assert_equal vc, VirtualCommunity.default
  17 + assert_equal vc, Environment.default
18 18 end
19 19  
20 20 def test_acts_as_configurable
21   - vc = VirtualCommunity.new(:name => 'Testing VirtualCommunity')
  21 + vc = Environment.new(:name => 'Testing Environment')
22 22 assert_kind_of Hash, vc.settings
23 23 vc.settings[:some_setting] = 1
24 24 assert vc.save
... ... @@ -26,11 +26,11 @@ class VirtualCommunityTest &lt; Test::Unit::TestCase
26 26 end
27 27  
28 28 def test_available_features
29   - assert_kind_of Hash, VirtualCommunity.available_features
  29 + assert_kind_of Hash, Environment.available_features
30 30 end
31 31  
32 32 def test_mock
33   - assert_equal ['feature1', 'feature2', 'feature3'], VirtualCommunity.available_features.keys.sort
  33 + assert_equal ['feature1', 'feature2', 'feature3'], Environment.available_features.keys.sort
34 34 end
35 35  
36 36 def test_features
... ... @@ -54,7 +54,7 @@ class VirtualCommunityTest &lt; Test::Unit::TestCase
54 54 end
55 55  
56 56 def test_name_is_mandatory
57   - v = VirtualCommunity.new
  57 + v = Environment.new
58 58 v.valid?
59 59 assert v.errors.invalid?(:name)
60 60 v.name = 'blablabla'
... ... @@ -63,23 +63,23 @@ class VirtualCommunityTest &lt; Test::Unit::TestCase
63 63 end
64 64  
65 65 def test_terms_of_use
66   - v = VirtualCommunity.new(:name => 'My test virtual community')
  66 + v = Environment.new(:name => 'My test virtual community')
67 67 assert_nil v.terms_of_use
68 68 v.terms_of_use = 'To be part of this virtual community, you must accept the following terms: ...'
69 69 assert v.save
70 70 id = v.id
71   - assert_equal 'To be part of this virtual community, you must accept the following terms: ...', VirtualCommunity.find(id).terms_of_use
  71 + assert_equal 'To be part of this virtual community, you must accept the following terms: ...', Environment.find(id).terms_of_use
72 72 end
73 73  
74 74 def test_has_terms_of_use
75   - v = VirtualCommunity.new
  75 + v = Environment.new
76 76 assert !v.has_terms_of_use?
77 77 v.terms_of_use = 'some terms of use'
78 78 assert v.has_terms_of_use?
79 79 end
80 80  
81 81 def test_should_profive_flexible_template_stuff
82   - v = VirtualCommunity.new
  82 + v = Environment.new
83 83  
84 84 # template
85 85 assert_nil v.flexible_template_template
... ...