Commit 6bfe1576751a73b82b6ae8f0a21d09d5ce4774b4

Authored by JoenioCosta
1 parent 064e5b0e

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
... ... @@ -7,8 +7,6 @@ Environment.destroy_all
7 7 User.destroy_all
8 8 Profile.destroy_all
9 9  
10   -Role.destroy_all
11   -RoleAssignment.destroy_all
12 10 Category.destroy_all
13 11 Product.destroy_all
14 12 Article.destroy_all
... ...
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)
... ...