summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-02-03 10:19:42 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-02-03 10:19:42 +0000
commitbf36b6b0bbb1ba32bc6642257860466915329c77 (patch)
tree86b0972a4c3fb07b25a4ffbc11e2632b4b4853a3 /test/unit
parent0afab2fb302e880930cc48b3ad16386222fe889e (diff)
downloadredmine-bf36b6b0bbb1ba32bc6642257860466915329c77.tar.gz
redmine-bf36b6b0bbb1ba32bc6642257860466915329c77.zip
Removing shoulda context.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11319 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/helpers/issues_helper_test.rb244
1 files changed, 106 insertions, 138 deletions
diff --git a/test/unit/helpers/issues_helper_test.rb b/test/unit/helpers/issues_helper_test.rb
index 73548fbc5..9565b3e35 100644
--- a/test/unit/helpers/issues_helper_test.rb
+++ b/test/unit/helpers/issues_helper_test.rb
@@ -64,164 +64,132 @@ class IssuesHelperTest < ActionView::TestCase
assert_equal l(:text_issues_destroy_confirmation), issues_destroy_confirmation_message(Issue.find([1, 2]))
end
- context "IssuesHelper#show_detail" do
- context "with no_html" do
- should 'show a changing attribute' do
- @detail = JournalDetail.new(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio')
- assert_equal "% Done changed from 40 to 100", show_detail(@detail, true)
- end
-
- should 'show a new attribute' do
- @detail = JournalDetail.new(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio')
- assert_equal "% Done set to 100", show_detail(@detail, true)
- end
-
- should 'show a deleted attribute' do
- @detail = JournalDetail.new(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio')
- assert_equal "% Done deleted (50)", show_detail(@detail, true)
- end
- end
+ test 'IssuesHelper#show_detail with no_html should show a changing attribute' do
+ detail = JournalDetail.new(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio')
+ assert_equal "% Done changed from 40 to 100", show_detail(detail, true)
+ end
- context "with html" do
- should 'show a changing attribute with HTML highlights' do
- @detail = JournalDetail.new(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio')
- html = show_detail(@detail, false)
+ test 'IssuesHelper#show_detail with no_html should show a new attribute' do
+ detail = JournalDetail.new(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio')
+ assert_equal "% Done set to 100", show_detail(detail, true)
+ end
- assert_include '<strong>% Done</strong>', html
- assert_include '<i>40</i>', html
- assert_include '<i>100</i>', html
- end
+ test 'IssuesHelper#show_detail with no_html should show a deleted attribute' do
+ detail = JournalDetail.new(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio')
+ assert_equal "% Done deleted (50)", show_detail(detail, true)
+ end
- should 'show a new attribute with HTML highlights' do
- @detail = JournalDetail.new(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio')
- html = show_detail(@detail, false)
+ test 'IssuesHelper#show_detail with html should show a changing attribute with HTML highlights' do
+ detail = JournalDetail.new(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio')
+ html = show_detail(detail, false)
- assert_include '<strong>% Done</strong>', html
- assert_include '<i>100</i>', html
- end
+ assert_include '<strong>% Done</strong>', html
+ assert_include '<i>40</i>', html
+ assert_include '<i>100</i>', html
+ end
- should 'show a deleted attribute with HTML highlights' do
- @detail = JournalDetail.new(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio')
- html = show_detail(@detail, false)
+ test 'IssuesHelper#show_detail with html should show a new attribute with HTML highlights' do
+ detail = JournalDetail.new(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio')
+ html = show_detail(detail, false)
- assert_include '<strong>% Done</strong>', html
- assert_include '<del><i>50</i></del>', html
- end
- end
+ assert_include '<strong>% Done</strong>', html
+ assert_include '<i>100</i>', html
+ end
- context "with a start_date attribute" do
- should "format the current date" do
- @detail = JournalDetail.new(
- :property => 'attr',
- :old_value => '2010-01-01',
- :value => '2010-01-31',
- :prop_key => 'start_date'
- )
- with_settings :date_format => '%m/%d/%Y' do
- assert_match "01/31/2010", show_detail(@detail, true)
- end
- end
-
- should "format the old date" do
- @detail = JournalDetail.new(
- :property => 'attr',
- :old_value => '2010-01-01',
- :value => '2010-01-31',
- :prop_key => 'start_date'
- )
- with_settings :date_format => '%m/%d/%Y' do
- assert_match "01/01/2010", show_detail(@detail, true)
- end
- end
- end
+ test 'IssuesHelper#show_detail with html should show a deleted attribute with HTML highlights' do
+ detail = JournalDetail.new(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio')
+ html = show_detail(detail, false)
- context "with a due_date attribute" do
- should "format the current date" do
- @detail = JournalDetail.new(
- :property => 'attr',
- :old_value => '2010-01-01',
- :value => '2010-01-31',
- :prop_key => 'due_date'
- )
- with_settings :date_format => '%m/%d/%Y' do
- assert_match "01/31/2010", show_detail(@detail, true)
- end
- end
-
- should "format the old date" do
- @detail = JournalDetail.new(
- :property => 'attr',
- :old_value => '2010-01-01',
- :value => '2010-01-31',
- :prop_key => 'due_date'
- )
- with_settings :date_format => '%m/%d/%Y' do
- assert_match "01/01/2010", show_detail(@detail, true)
- end
- end
- end
+ assert_include '<strong>% Done</strong>', html
+ assert_include '<del><i>50</i></del>', html
+ end
- should "show old and new values with a project attribute" do
- detail = JournalDetail.new(:property => 'attr', :prop_key => 'project_id', :old_value => 1, :value => 2)
- assert_match 'eCookbook', show_detail(detail, true)
- assert_match 'OnlineStore', show_detail(detail, true)
+ test 'IssuesHelper#show_detail with a start_date attribute should format the dates' do
+ detail = JournalDetail.new(
+ :property => 'attr',
+ :old_value => '2010-01-01',
+ :value => '2010-01-31',
+ :prop_key => 'start_date'
+ )
+ with_settings :date_format => '%m/%d/%Y' do
+ assert_match "01/31/2010", show_detail(detail, true)
+ assert_match "01/01/2010", show_detail(detail, true)
end
+ end
- should "show old and new values with a issue status attribute" do
- detail = JournalDetail.new(:property => 'attr', :prop_key => 'status_id', :old_value => 1, :value => 2)
- assert_match 'New', show_detail(detail, true)
- assert_match 'Assigned', show_detail(detail, true)
+ test 'IssuesHelper#show_detail with a due_date attribute should format the dates' do
+ detail = JournalDetail.new(
+ :property => 'attr',
+ :old_value => '2010-01-01',
+ :value => '2010-01-31',
+ :prop_key => 'due_date'
+ )
+ with_settings :date_format => '%m/%d/%Y' do
+ assert_match "01/31/2010", show_detail(detail, true)
+ assert_match "01/01/2010", show_detail(detail, true)
end
+ end
- should "show old and new values with a tracker attribute" do
- detail = JournalDetail.new(:property => 'attr', :prop_key => 'tracker_id', :old_value => 1, :value => 2)
- assert_match 'Bug', show_detail(detail, true)
- assert_match 'Feature request', show_detail(detail, true)
- end
+ test 'IssuesHelper#show_detail should show old and new values with a project attribute' do
+ detail = JournalDetail.new(:property => 'attr', :prop_key => 'project_id', :old_value => 1, :value => 2)
+ assert_match 'eCookbook', show_detail(detail, true)
+ assert_match 'OnlineStore', show_detail(detail, true)
+ end
- should "show old and new values with a assigned to attribute" do
- detail = JournalDetail.new(:property => 'attr', :prop_key => 'assigned_to_id', :old_value => 1, :value => 2)
- assert_match 'Redmine Admin', show_detail(detail, true)
- assert_match 'John Smith', show_detail(detail, true)
- end
+ test 'IssuesHelper#show_detail should show old and new values with a issue status attribute' do
+ detail = JournalDetail.new(:property => 'attr', :prop_key => 'status_id', :old_value => 1, :value => 2)
+ assert_match 'New', show_detail(detail, true)
+ assert_match 'Assigned', show_detail(detail, true)
+ end
- should "show old and new values with a priority attribute" do
- detail = JournalDetail.new(:property => 'attr', :prop_key => 'priority_id', :old_value => 4, :value => 5)
- assert_match 'Low', show_detail(detail, true)
- assert_match 'Normal', show_detail(detail, true)
- end
+ test 'IssuesHelper#show_detail should show old and new values with a tracker attribute' do
+ detail = JournalDetail.new(:property => 'attr', :prop_key => 'tracker_id', :old_value => 1, :value => 2)
+ assert_match 'Bug', show_detail(detail, true)
+ assert_match 'Feature request', show_detail(detail, true)
+ end
- should "show old and new values with a category attribute" do
- detail = JournalDetail.new(:property => 'attr', :prop_key => 'category_id', :old_value => 1, :value => 2)
- assert_match 'Printing', show_detail(detail, true)
- assert_match 'Recipes', show_detail(detail, true)
- end
+ test 'IssuesHelper#show_detail should show old and new values with a assigned to attribute' do
+ detail = JournalDetail.new(:property => 'attr', :prop_key => 'assigned_to_id', :old_value => 1, :value => 2)
+ assert_match 'Redmine Admin', show_detail(detail, true)
+ assert_match 'John Smith', show_detail(detail, true)
+ end
- should "show old and new values with a fixed version attribute" do
- detail = JournalDetail.new(:property => 'attr', :prop_key => 'fixed_version_id', :old_value => 1, :value => 2)
- assert_match '0.1', show_detail(detail, true)
- assert_match '1.0', show_detail(detail, true)
- end
+ test 'IssuesHelper#show_detail should show old and new values with a priority attribute' do
+ detail = JournalDetail.new(:property => 'attr', :prop_key => 'priority_id', :old_value => 4, :value => 5)
+ assert_match 'Low', show_detail(detail, true)
+ assert_match 'Normal', show_detail(detail, true)
+ end
- should "show old and new values with a estimated hours attribute" do
- detail = JournalDetail.new(:property => 'attr', :prop_key => 'estimated_hours', :old_value => '5', :value => '6.3')
- assert_match '5.00', show_detail(detail, true)
- assert_match '6.30', show_detail(detail, true)
- end
+ test 'IssuesHelper#show_detail should show old and new values with a category attribute' do
+ detail = JournalDetail.new(:property => 'attr', :prop_key => 'category_id', :old_value => 1, :value => 2)
+ assert_match 'Printing', show_detail(detail, true)
+ assert_match 'Recipes', show_detail(detail, true)
+ end
- should "show old and new values with a custom field" do
- detail = JournalDetail.new(:property => 'cf', :prop_key => '1', :old_value => 'MySQL', :value => 'PostgreSQL')
- assert_equal 'Database changed from MySQL to PostgreSQL', show_detail(detail, true)
- end
+ test 'IssuesHelper#show_detail should show old and new values with a fixed version attribute' do
+ detail = JournalDetail.new(:property => 'attr', :prop_key => 'fixed_version_id', :old_value => 1, :value => 2)
+ assert_match '0.1', show_detail(detail, true)
+ assert_match '1.0', show_detail(detail, true)
+ end
- should "show added file" do
- detail = JournalDetail.new(:property => 'attachment', :prop_key => '1', :old_value => nil, :value => 'error281.txt')
- assert_match 'error281.txt', show_detail(detail, true)
- end
+ test 'IssuesHelper#show_detail should show old and new values with a estimated hours attribute' do
+ detail = JournalDetail.new(:property => 'attr', :prop_key => 'estimated_hours', :old_value => '5', :value => '6.3')
+ assert_match '5.00', show_detail(detail, true)
+ assert_match '6.30', show_detail(detail, true)
+ end
- should "show removed file" do
- detail = JournalDetail.new(:property => 'attachment', :prop_key => '1', :old_value => 'error281.txt', :value => nil)
- assert_match 'error281.txt', show_detail(detail, true)
- end
+ test 'IssuesHelper#show_detail should show old and new values with a custom field' do
+ detail = JournalDetail.new(:property => 'cf', :prop_key => '1', :old_value => 'MySQL', :value => 'PostgreSQL')
+ assert_equal 'Database changed from MySQL to PostgreSQL', show_detail(detail, true)
+ end
+
+ test 'IssuesHelper#show_detail should show added file' do
+ detail = JournalDetail.new(:property => 'attachment', :prop_key => '1', :old_value => nil, :value => 'error281.txt')
+ assert_match 'error281.txt', show_detail(detail, true)
+ end
+
+ test 'IssuesHelper#show_detail should show removed file' do
+ detail = JournalDetail.new(:property => 'attachment', :prop_key => '1', :old_value => 'error281.txt', :value => nil)
+ assert_match 'error281.txt', show_detail(detail, true)
end
end