OSDN Git Service

Added shoulda macros to test Project's associations
authorEric Davis <edavis@littlestreamsoftware.com>
Mon, 19 Oct 2009 00:27:13 +0000 (00:27 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Mon, 19 Oct 2009 00:27:13 +0000 (00:27 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2936 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/project_test.rb

index 6f985cb..fa163cf 100644 (file)
@@ -34,6 +34,30 @@ class ProjectTest < ActiveSupport::TestCase
   should_validate_uniqueness_of :name
   should_validate_uniqueness_of :identifier
 
+  context "associations" do
+    should_have_many :members
+    should_have_many :users, :through => :members
+    should_have_many :member_principals
+    should_have_many :principals, :through => :member_principals
+    should_have_many :enabled_modules
+    should_have_many :issues
+    should_have_many :issue_changes, :through => :issues
+    should_have_many :versions
+    should_have_many :time_entries
+    should_have_many :queries
+    should_have_many :documents
+    should_have_many :news
+    should_have_many :issue_categories
+    should_have_many :boards
+    should_have_many :changesets, :through => :repository
+
+    should_have_one :repository
+    should_have_one :wiki
+
+    should_have_and_belong_to_many :trackers
+    should_have_and_belong_to_many :issue_custom_fields
+  end
+
   def test_truth
     assert_kind_of Project, @ecookbook
     assert_equal "eCookbook", @ecookbook.name