Commit 6bfe1576751a73b82b6ae8f0a21d09d5ce4774b4
1 parent
064e5b0e
Exists in
master
and in
22 other branches
ActionItem261: creating development environment from zero in Debian Etch
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1979 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
23 additions
and
2 deletions
Show diff stats
script/anhetegua
test/unit/category_test.rb
... | ... | @@ -145,6 +145,29 @@ class CategoryTest < Test::Unit::TestCase |
145 | 145 | |
146 | 146 | end |
147 | 147 | |
148 | + should 'be able to duplicated slug in different scope' do | |
149 | + @env.categories.destroy_all | |
150 | + | |
151 | + root1 = Category.create!(:name => 'root category 1', :environment_id => @env.id) | |
152 | + root2 = Category.create!(:name => 'root category 2', :environment_id => @env.id) | |
153 | + | |
154 | + assert_nothing_raised ActiveRecord::RecordInvalid do | |
155 | + Category.create!(:name => 'test category', :environment_id => @env.id, :parent => root1) | |
156 | + Category.create!(:name => 'test category', :environment_id => @env.id, :parent => root2) | |
157 | + end | |
158 | + end | |
159 | + | |
160 | + should 'be able to duplicated slug in different scope without parent' do | |
161 | + @env.categories.destroy_all | |
162 | + | |
163 | + root1 = Category.create!(:name => 'root category 1', :environment_id => @env.id) | |
164 | + | |
165 | + #assert_nothing_raised ActiveRecord::RecordInvalid do | |
166 | + Category.create!(:name => 'test category', :environment_id => @env.id, :parent => root1) | |
167 | + Category.create!(:name => 'test category', :environment_id => @env.id, :parent => nil) | |
168 | + #end | |
169 | + end | |
170 | + | |
148 | 171 | def test_renaming_a_category_should_change_path_of_children |
149 | 172 | c1 = Category.create!(:name => 'parent', :environment_id => @env.id) |
150 | 173 | c2 = Category.create!(:name => 'child', :environment_id => @env.id, :parent_id => c1.id) | ... | ... |