summaryrefslogtreecommitdiffstats
path: root/test/unit/project_test.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2009-10-19 00:07:23 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2009-10-19 00:07:23 +0000
commit548d5a21f693a8467fad86c18eb8f5c192e6e210 (patch)
tree9887010c81b4c43206d89f7441dd874e20ba2e5d /test/unit/project_test.rb
parent35333367dff6a3415bfc00904ac88d42024217f6 (diff)
downloadredmine-548d5a21f693a8467fad86c18eb8f5c192e6e210.tar.gz
redmine-548d5a21f693a8467fad86c18eb8f5c192e6e210.zip
Converted Project#copy test to use shoulda
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2931 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/project_test.rb')
-rw-r--r--test/unit/project_test.rb107
1 files changed, 55 insertions, 52 deletions
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb
index a1eac7138..f3fe1c814 100644
--- a/test/unit/project_test.rb
+++ b/test/unit/project_test.rb
@@ -289,67 +289,70 @@ class ProjectTest < ActiveSupport::TestCase
# Default attributes
assert_equal 1, copied_project.status
end
-
- # Context: Project#copy
- def test_copy_should_copy_issues
- # Setup
- ProjectCustomField.destroy_all # Custom values are a mess to isolate in tests
- source_project = Project.find(2)
- Project.destroy_all :identifier => "copy-test"
- project = Project.new(:name => 'Copy Test', :identifier => 'copy-test')
- project.trackers = source_project.trackers
- assert project.valid?
-
- assert project.issues.empty?
- assert project.copy(source_project)
- # Tests
- assert_equal source_project.issues.size, project.issues.size
- project.issues.each do |issue|
- assert issue.valid?
- assert ! issue.assigned_to.blank?
- assert_equal project, issue.project
+ context "#copy" do
+
+ should "copy issues" do
+ # Setup
+ ProjectCustomField.destroy_all # Custom values are a mess to isolate in tests
+ source_project = Project.find(2)
+ Project.destroy_all :identifier => "copy-test"
+ project = Project.new(:name => 'Copy Test', :identifier => 'copy-test')
+ project.trackers = source_project.trackers
+ assert project.valid?
+
+ assert project.issues.empty?
+ assert project.copy(source_project)
+
+ # Tests
+ assert_equal source_project.issues.size, project.issues.size
+ project.issues.each do |issue|
+ assert issue.valid?
+ assert ! issue.assigned_to.blank?
+ assert_equal project, issue.project
+ end
end
- end
-
- def test_copy_should_copy_members
- # Setup
- ProjectCustomField.destroy_all # Custom values are a mess to isolate in tests
- source_project = Project.find(2)
- project = Project.new(:name => 'Copy Test', :identifier => 'copy-test')
- project.trackers = source_project.trackers
- project.enabled_modules = source_project.enabled_modules
- assert project.valid?
- assert project.members.empty?
- assert project.copy(source_project)
+ should "copy members" do
+ # Setup
+ ProjectCustomField.destroy_all # Custom values are a mess to isolate in tests
+ source_project = Project.find(2)
+ project = Project.new(:name => 'Copy Test', :identifier => 'copy-test')
+ project.trackers = source_project.trackers
+ project.enabled_modules = source_project.enabled_modules
+ assert project.valid?
+
+ assert project.members.empty?
+ assert project.copy(source_project)
- # Tests
- assert_equal source_project.members.size, project.members.size
- project.members.each do |member|
- assert member
- assert_equal project, member.project
+ # Tests
+ assert_equal source_project.members.size, project.members.size
+ project.members.each do |member|
+ assert member
+ assert_equal project, member.project
+ end
end
- end
- def test_copy_should_copy_project_level_queries
- # Setup
- ProjectCustomField.destroy_all # Custom values are a mess to isolate in tests
- source_project = Project.find(2)
- project = Project.new(:name => 'Copy Test', :identifier => 'copy-test')
- project.trackers = source_project.trackers
- project.enabled_modules = source_project.enabled_modules
- assert project.valid?
+ should "copy project specific queries" do
+ # Setup
+ ProjectCustomField.destroy_all # Custom values are a mess to isolate in tests
+ source_project = Project.find(2)
+ project = Project.new(:name => 'Copy Test', :identifier => 'copy-test')
+ project.trackers = source_project.trackers
+ project.enabled_modules = source_project.enabled_modules
+ assert project.valid?
- assert project.queries.empty?
- assert project.copy(source_project)
+ assert project.queries.empty?
+ assert project.copy(source_project)
- # Tests
- assert_equal source_project.queries.size, project.queries.size
- project.queries.each do |query|
- assert query
- assert_equal project, query.project
+ # Tests
+ assert_equal source_project.queries.size, project.queries.size
+ project.queries.each do |query|
+ assert query
+ assert_equal project, query.project
+ end
end
+
end
end