summaryrefslogtreecommitdiffstats
path: root/test/test_helper.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-03-08 16:47:47 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-03-08 16:47:47 +0000
commit1a73f8fa0f46cd7a1c1ef1f548f22214e06c51da (patch)
tree17ca622120ba3bbe7b37c88bb58fa482a8734e04 /test/test_helper.rb
parentfe066e793d061c6c982a6998b683b6336434a5b3 (diff)
downloadredmine-1a73f8fa0f46cd7a1c1ef1f548f22214e06c51da.tar.gz
redmine-1a73f8fa0f46cd7a1c1ef1f548f22214e06c51da.zip
Added unit tests for IssuesHelper#show_detail
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3552 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r--test/test_helper.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb
index f5cc198de..48e2c999a 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -111,4 +111,35 @@ class ActiveSupport::TestCase
}.size
end
end
+
+ def self.should_show_the_old_and_new_values_for(prop_key, model, &block)
+ context "" do
+ setup do
+ if block_given?
+ instance_eval &block
+ else
+ @old_value = model.generate!
+ @new_value = model.generate!
+ end
+ end
+
+ should "use the new value's name" do
+ @detail = JournalDetail.generate!(:property => 'attr',
+ :old_value => @old_value.id,
+ :value => @new_value.id,
+ :prop_key => prop_key)
+
+ assert_match @new_value.name, show_detail(@detail, true)
+ end
+
+ should "use the old value's name" do
+ @detail = JournalDetail.generate!(:property => 'attr',
+ :old_value => @old_value.id,
+ :value => @new_value.id,
+ :prop_key => prop_key)
+
+ assert_match @old_value.name, show_detail(@detail, true)
+ end
+ end
+ end
end