summaryrefslogtreecommitdiffstats
path: root/test/functional/calendars_controller_test.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-06-19 22:52:15 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-06-19 22:52:15 +0000
commit41ff1b9cb2648eab0c8d67b074de81efe1eabb78 (patch)
tree975ac1b7c3783021a44291b28bb7ca67ff780ff1 /test/functional/calendars_controller_test.rb
parentb2e903ff7c7eb0de8576dcd8ebd90e8322ebf594 (diff)
downloadredmine-41ff1b9cb2648eab0c8d67b074de81efe1eabb78.tar.gz
redmine-41ff1b9cb2648eab0c8d67b074de81efe1eabb78.zip
Display the correct ISO week number on the project calendar.
http://en.wikipedia.org/wiki/ISO_week Contributed by Holger Just git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3790 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/calendars_controller_test.rb')
-rw-r--r--test/functional/calendars_controller_test.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/functional/calendars_controller_test.rb b/test/functional/calendars_controller_test.rb
index fa07fdd47..79cfe28a0 100644
--- a/test/functional/calendars_controller_test.rb
+++ b/test/functional/calendars_controller_test.rb
@@ -17,4 +17,48 @@ class CalendarsControllerTest < ActionController::TestCase
assert_not_nil assigns(:calendar)
end
+ def test_week_number_calculation
+ Setting.start_of_week = 7
+
+ get :show, :month => '1', :year => '2010'
+ assert_response :success
+
+ assert_tag :tag => 'tr',
+ :descendant => {:tag => 'td',
+ :attributes => {:class => 'week-number'}, :content => '53'},
+ :descendant => {:tag => 'td',
+ :attributes => {:class => 'odd'}, :content => '27'},
+ :descendant => {:tag => 'td',
+ :attributes => {:class => 'even'}, :content => '2'}
+
+ assert_tag :tag => 'tr',
+ :descendant => {:tag => 'td',
+ :attributes => {:class => 'week-number'}, :content => '1'},
+ :descendant => {:tag => 'td',
+ :attributes => {:class => 'odd'}, :content => '3'},
+ :descendant => {:tag => 'td',
+ :attributes => {:class => 'even'}, :content => '9'}
+
+
+ Setting.start_of_week = 1
+ get :show, :month => '1', :year => '2010'
+ assert_response :success
+
+ assert_tag :tag => 'tr',
+ :descendant => {:tag => 'td',
+ :attributes => {:class => 'week-number'}, :content => '53'},
+ :descendant => {:tag => 'td',
+ :attributes => {:class => 'even'}, :content => '28'},
+ :descendant => {:tag => 'td',
+ :attributes => {:class => 'even'}, :content => '3'}
+
+ assert_tag :tag => 'tr',
+ :descendant => {:tag => 'td',
+ :attributes => {:class => 'week-number'}, :content => '1'},
+ :descendant => {:tag => 'td',
+ :attributes => {:class => 'even'}, :content => '4'},
+ :descendant => {:tag => 'td',
+ :attributes => {:class => 'even'}, :content => '10'}
+
+ end
end