Commit f7932a0db2be91c3fca1f7ac293cf5ea667a0d07
1 parent
5a6724e7
Exists in
master
and in
29 other branches
ActionItem153: adding needed relationships to Environment
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1274 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
10 additions
and
7 deletions
Show diff stats
app/models/environment.rb
@@ -39,6 +39,8 @@ class Environment < ActiveRecord::Base | @@ -39,6 +39,8 @@ class Environment < ActiveRecord::Base | ||
39 | has_many :profiles | 39 | has_many :profiles |
40 | 40 | ||
41 | has_many :organizations | 41 | has_many :organizations |
42 | + has_many :enterprises | ||
43 | + has_many :people | ||
42 | 44 | ||
43 | has_many :categories | 45 | has_many :categories |
44 | has_many :display_categories, :class_name => 'Category', :conditions => 'display_color is not null and parent_id is null', :order => 'display_color' | 46 | has_many :display_categories, :class_name => 'Category', :conditions => 'display_color is not null and parent_id is null', :order => 'display_color' |
test/test_helper.rb
@@ -63,11 +63,14 @@ class Test::Unit::TestCase | @@ -63,11 +63,14 @@ class Test::Unit::TestCase | ||
63 | env | 63 | env |
64 | end | 64 | end |
65 | 65 | ||
66 | - def create_user(name) | ||
67 | - User.create!(:login => name, | ||
68 | - :email => name + '@noosfero.org', | ||
69 | - :password => name.underscore, | ||
70 | - :password_confirmation => name.underscore) | 66 | + def create_user(name, options = {}) |
67 | + data = { | ||
68 | + :login => name, | ||
69 | + :email => name + '@noosfero.org', | ||
70 | + :password => name.underscore, | ||
71 | + :password_confirmation => name.underscore | ||
72 | + }.merge(options) | ||
73 | + User.create!(data) | ||
71 | end | 74 | end |
72 | 75 | ||
73 | def create_user_with_permission(name, permission, target= nil) | 76 | def create_user_with_permission(name, permission, target= nil) |
test/unit/enterprise_test.rb
@@ -54,8 +54,6 @@ class EnterpriseTest < Test::Unit::TestCase | @@ -54,8 +54,6 @@ class EnterpriseTest < Test::Unit::TestCase | ||
54 | assert_difference Product, :count, -2 do | 54 | assert_difference Product, :count, -2 do |
55 | e.destroy | 55 | e.destroy |
56 | end | 56 | end |
57 | - | ||
58 | - | ||
59 | end | 57 | end |
60 | 58 | ||
61 | end | 59 | end |