To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / .svn / pristine / 9c / 9c3af39547b04b7831f942c7b6b88179c7934a14.svn-base @ 1297:0a574315af3e
History | View | Annotate | Download (2.51 KB)
| 1 |
require File.expand_path('../../test_helper', __FILE__)
|
|---|---|
| 2 |
|
| 3 |
class CalendarsControllerTest < ActionController::TestCase |
| 4 |
fixtures :projects, |
| 5 |
:trackers, |
| 6 |
:projects_trackers, |
| 7 |
:roles, |
| 8 |
:member_roles, |
| 9 |
:members, |
| 10 |
:auth_sources, |
| 11 |
:enabled_modules |
| 12 |
|
| 13 |
def test_calendar |
| 14 |
get :show, :project_id => 1 |
| 15 |
assert_response :success |
| 16 |
assert_template 'calendar' |
| 17 |
assert_not_nil assigns(:calendar) |
| 18 |
end |
| 19 |
|
| 20 |
def test_cross_project_calendar |
| 21 |
get :show |
| 22 |
assert_response :success |
| 23 |
assert_template 'calendar' |
| 24 |
assert_not_nil assigns(:calendar) |
| 25 |
end |
| 26 |
|
| 27 |
context "GET :show" do |
| 28 |
should "run custom queries" do |
| 29 |
@query = Query.generate_default!(:is_public => true) |
| 30 |
|
| 31 |
get :show, :query_id => @query.id |
| 32 |
assert_response :success |
| 33 |
end |
| 34 |
|
| 35 |
end |
| 36 |
|
| 37 |
def test_week_number_calculation |
| 38 |
Setting.start_of_week = 7 |
| 39 |
|
| 40 |
get :show, :month => '1', :year => '2010' |
| 41 |
assert_response :success |
| 42 |
|
| 43 |
assert_tag :tag => 'tr', |
| 44 |
:descendant => {:tag => 'td',
|
| 45 |
:attributes => {:class => 'week-number'}, :content => '53'},
|
| 46 |
:descendant => {:tag => 'td',
|
| 47 |
:attributes => {:class => 'odd'}, :content => '27'},
|
| 48 |
:descendant => {:tag => 'td',
|
| 49 |
:attributes => {:class => 'even'}, :content => '2'}
|
| 50 |
|
| 51 |
assert_tag :tag => 'tr', |
| 52 |
:descendant => {:tag => 'td',
|
| 53 |
:attributes => {:class => 'week-number'}, :content => '1'},
|
| 54 |
:descendant => {:tag => 'td',
|
| 55 |
:attributes => {:class => 'odd'}, :content => '3'},
|
| 56 |
:descendant => {:tag => 'td',
|
| 57 |
:attributes => {:class => 'even'}, :content => '9'}
|
| 58 |
|
| 59 |
|
| 60 |
Setting.start_of_week = 1 |
| 61 |
get :show, :month => '1', :year => '2010' |
| 62 |
assert_response :success |
| 63 |
|
| 64 |
assert_tag :tag => 'tr', |
| 65 |
:descendant => {:tag => 'td',
|
| 66 |
:attributes => {:class => 'week-number'}, :content => '53'},
|
| 67 |
:descendant => {:tag => 'td',
|
| 68 |
:attributes => {:class => 'even'}, :content => '28'},
|
| 69 |
:descendant => {:tag => 'td',
|
| 70 |
:attributes => {:class => 'even'}, :content => '3'}
|
| 71 |
|
| 72 |
assert_tag :tag => 'tr', |
| 73 |
:descendant => {:tag => 'td',
|
| 74 |
:attributes => {:class => 'week-number'}, :content => '1'},
|
| 75 |
:descendant => {:tag => 'td',
|
| 76 |
:attributes => {:class => 'even'}, :content => '4'},
|
| 77 |
:descendant => {:tag => 'td',
|
| 78 |
:attributes => {:class => 'even'}, :content => '10'}
|
| 79 |
|
| 80 |
end |
| 81 |
end |