annotate test/functional/calendars_controller_test.rb @ 1452:d6b9fd02bb89 feature_36_js_refactoring

Deprecated develoment branch.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Fri, 11 Oct 2013 17:01:24 +0100
parents 0c939c159af4
children cbb26bc654de
rev   line source
Chris@119 1 require File.expand_path('../../test_helper', __FILE__)
Chris@0 2
Chris@0 3 class CalendarsControllerTest < ActionController::TestCase
Chris@0 4 fixtures :all
Chris@0 5
Chris@0 6 def test_calendar
Chris@0 7 get :show, :project_id => 1
Chris@0 8 assert_response :success
Chris@0 9 assert_template 'calendar'
Chris@0 10 assert_not_nil assigns(:calendar)
Chris@0 11 end
Chris@0 12
Chris@0 13 def test_cross_project_calendar
Chris@0 14 get :show
Chris@0 15 assert_response :success
Chris@0 16 assert_template 'calendar'
Chris@0 17 assert_not_nil assigns(:calendar)
Chris@0 18 end
chris@37 19
chris@37 20 context "GET :show" do
chris@37 21 should "run custom queries" do
Chris@507 22 @query = Query.generate_default!(:is_public => true)
chris@37 23
chris@37 24 get :show, :query_id => @query.id
chris@37 25 assert_response :success
chris@37 26 end
chris@37 27
chris@37 28 end
Chris@0 29
Chris@0 30 def test_week_number_calculation
Chris@0 31 Setting.start_of_week = 7
Chris@0 32
Chris@0 33 get :show, :month => '1', :year => '2010'
Chris@0 34 assert_response :success
Chris@0 35
Chris@0 36 assert_tag :tag => 'tr',
Chris@0 37 :descendant => {:tag => 'td',
Chris@0 38 :attributes => {:class => 'week-number'}, :content => '53'},
Chris@0 39 :descendant => {:tag => 'td',
Chris@0 40 :attributes => {:class => 'odd'}, :content => '27'},
Chris@0 41 :descendant => {:tag => 'td',
Chris@0 42 :attributes => {:class => 'even'}, :content => '2'}
Chris@0 43
Chris@0 44 assert_tag :tag => 'tr',
Chris@0 45 :descendant => {:tag => 'td',
Chris@0 46 :attributes => {:class => 'week-number'}, :content => '1'},
Chris@0 47 :descendant => {:tag => 'td',
Chris@0 48 :attributes => {:class => 'odd'}, :content => '3'},
Chris@0 49 :descendant => {:tag => 'td',
Chris@0 50 :attributes => {:class => 'even'}, :content => '9'}
Chris@0 51
Chris@0 52
Chris@0 53 Setting.start_of_week = 1
Chris@0 54 get :show, :month => '1', :year => '2010'
Chris@0 55 assert_response :success
Chris@0 56
Chris@0 57 assert_tag :tag => 'tr',
Chris@0 58 :descendant => {:tag => 'td',
Chris@0 59 :attributes => {:class => 'week-number'}, :content => '53'},
Chris@0 60 :descendant => {:tag => 'td',
Chris@0 61 :attributes => {:class => 'even'}, :content => '28'},
Chris@0 62 :descendant => {:tag => 'td',
Chris@0 63 :attributes => {:class => 'even'}, :content => '3'}
Chris@0 64
Chris@0 65 assert_tag :tag => 'tr',
Chris@0 66 :descendant => {:tag => 'td',
Chris@0 67 :attributes => {:class => 'week-number'}, :content => '1'},
Chris@0 68 :descendant => {:tag => 'td',
Chris@0 69 :attributes => {:class => 'even'}, :content => '4'},
Chris@0 70 :descendant => {:tag => 'td',
Chris@0 71 :attributes => {:class => 'even'}, :content => '10'}
Chris@0 72
Chris@0 73 end
Chris@0 74 end