##// END OF EJS Templates
No need to save the record....
Jean-Philippe Lang -
r8957:bcd8c643844f
parent child
Show More
@@ -63,24 +63,24 class IssuesHelperTest < ActionView::TestCase
63 context "IssuesHelper#show_detail" do
63 context "IssuesHelper#show_detail" do
64 context "with no_html" do
64 context "with no_html" do
65 should 'show a changing attribute' do
65 should 'show a changing attribute' do
66 @detail = JournalDetail.generate!(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio')
66 @detail = JournalDetail.new(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio')
67 assert_equal "% Done changed from 40 to 100", show_detail(@detail, true)
67 assert_equal "% Done changed from 40 to 100", show_detail(@detail, true)
68 end
68 end
69
69
70 should 'show a new attribute' do
70 should 'show a new attribute' do
71 @detail = JournalDetail.generate!(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio')
71 @detail = JournalDetail.new(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio')
72 assert_equal "% Done set to 100", show_detail(@detail, true)
72 assert_equal "% Done set to 100", show_detail(@detail, true)
73 end
73 end
74
74
75 should 'show a deleted attribute' do
75 should 'show a deleted attribute' do
76 @detail = JournalDetail.generate!(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio')
76 @detail = JournalDetail.new(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio')
77 assert_equal "% Done deleted (50)", show_detail(@detail, true)
77 assert_equal "% Done deleted (50)", show_detail(@detail, true)
78 end
78 end
79 end
79 end
80
80
81 context "with html" do
81 context "with html" do
82 should 'show a changing attribute with HTML highlights' do
82 should 'show a changing attribute with HTML highlights' do
83 @detail = JournalDetail.generate!(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio')
83 @detail = JournalDetail.new(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio')
84 html = show_detail(@detail, false)
84 html = show_detail(@detail, false)
85
85
86 assert_include '<strong>% Done</strong>', html
86 assert_include '<strong>% Done</strong>', html
@@ -89,7 +89,7 class IssuesHelperTest < ActionView::TestCase
89 end
89 end
90
90
91 should 'show a new attribute with HTML highlights' do
91 should 'show a new attribute with HTML highlights' do
92 @detail = JournalDetail.generate!(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio')
92 @detail = JournalDetail.new(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio')
93 html = show_detail(@detail, false)
93 html = show_detail(@detail, false)
94
94
95 assert_include '<strong>% Done</strong>', html
95 assert_include '<strong>% Done</strong>', html
@@ -97,7 +97,7 class IssuesHelperTest < ActionView::TestCase
97 end
97 end
98
98
99 should 'show a deleted attribute with HTML highlights' do
99 should 'show a deleted attribute with HTML highlights' do
100 @detail = JournalDetail.generate!(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio')
100 @detail = JournalDetail.new(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio')
101 html = show_detail(@detail, false)
101 html = show_detail(@detail, false)
102
102
103 assert_include '<strong>% Done</strong>', html
103 assert_include '<strong>% Done</strong>', html
@@ -107,24 +107,24 class IssuesHelperTest < ActionView::TestCase
107
107
108 context "with a start_date attribute" do
108 context "with a start_date attribute" do
109 should "format the current date" do
109 should "format the current date" do
110 @detail = JournalDetail.generate!(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'start_date')
110 @detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'start_date')
111 assert_match "01/31/2010", show_detail(@detail, true)
111 assert_match "01/31/2010", show_detail(@detail, true)
112 end
112 end
113
113
114 should "format the old date" do
114 should "format the old date" do
115 @detail = JournalDetail.generate!(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'start_date')
115 @detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'start_date')
116 assert_match "01/01/2010", show_detail(@detail, true)
116 assert_match "01/01/2010", show_detail(@detail, true)
117 end
117 end
118 end
118 end
119
119
120 context "with a due_date attribute" do
120 context "with a due_date attribute" do
121 should "format the current date" do
121 should "format the current date" do
122 @detail = JournalDetail.generate!(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'due_date')
122 @detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'due_date')
123 assert_match "01/31/2010", show_detail(@detail, true)
123 assert_match "01/31/2010", show_detail(@detail, true)
124 end
124 end
125
125
126 should "format the old date" do
126 should "format the old date" do
127 @detail = JournalDetail.generate!(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'due_date')
127 @detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'due_date')
128 assert_match "01/01/2010", show_detail(@detail, true)
128 assert_match "01/01/2010", show_detail(@detail, true)
129 end
129 end
130 end
130 end
General Comments 0
You need to be logged in to leave comments. Login now