replace shoulder "with a due_date attribute" context of unit IssuesHelperTest and use with_settings

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10263 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2012-09-01 05:33:28 +00:00
parent 4bca584024
commit 8eb39d682d
1 changed files with 17 additions and 5 deletions

View File

@ -133,14 +133,26 @@ class IssuesHelperTest < ActionView::TestCase
end end
end end
context "with a due_date attribute" do def test_with_a_due_date_attribute_should_with_a_due_date_attribute
should "format the current date" do @detail = JournalDetail.new(
@detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'due_date') :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/31/2010", show_detail(@detail, true)
end end
end
should "format the old date" do def test_with_a_due_date_attribute_should_format_the_old_date
@detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'due_date') @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) assert_match "01/01/2010", show_detail(@detail, true)
end end
end end