From 6bfe1576751a73b82b6ae8f0a21d09d5ce4774b4 Mon Sep 17 00:00:00 2001 From: JoenioCosta Date: Tue, 10 Jun 2008 02:38:27 +0000 Subject: [PATCH] ActionItem261: creating development environment from zero in Debian Etch --- script/anhetegua | 2 -- test/unit/category_test.rb | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/script/anhetegua b/script/anhetegua index 2379dbe..948e130 100755 --- a/script/anhetegua +++ b/script/anhetegua @@ -7,8 +7,6 @@ Environment.destroy_all User.destroy_all Profile.destroy_all -Role.destroy_all -RoleAssignment.destroy_all Category.destroy_all Product.destroy_all Article.destroy_all diff --git a/test/unit/category_test.rb b/test/unit/category_test.rb index a5bfb6e..c0cf055 100644 --- a/test/unit/category_test.rb +++ b/test/unit/category_test.rb @@ -145,6 +145,29 @@ class CategoryTest < Test::Unit::TestCase end + should 'be able to duplicated slug in different scope' do + @env.categories.destroy_all + + root1 = Category.create!(:name => 'root category 1', :environment_id => @env.id) + root2 = Category.create!(:name => 'root category 2', :environment_id => @env.id) + + assert_nothing_raised ActiveRecord::RecordInvalid do + Category.create!(:name => 'test category', :environment_id => @env.id, :parent => root1) + Category.create!(:name => 'test category', :environment_id => @env.id, :parent => root2) + end + end + + should 'be able to duplicated slug in different scope without parent' do + @env.categories.destroy_all + + root1 = Category.create!(:name => 'root category 1', :environment_id => @env.id) + + #assert_nothing_raised ActiveRecord::RecordInvalid do + Category.create!(:name => 'test category', :environment_id => @env.id, :parent => root1) + Category.create!(:name => 'test category', :environment_id => @env.id, :parent => nil) + #end + end + def test_renaming_a_category_should_change_path_of_children c1 = Category.create!(:name => 'parent', :environment_id => @env.id) c2 = Category.create!(:name => 'child', :environment_id => @env.id, :parent_id => c1.id) -- libgit2 0.21.2