annotate .svn/pristine/44/44669c27372c172ef04555f4bb81865f6ca83884.svn-base @ 1327:287f201c2802 redmine-2.2-integration

Add italic
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Wed, 19 Jun 2013 20:56:22 +0100
parents cbb26bc654de
children
rev   line source
Chris@909 1 require File.expand_path('../../test_helper', __FILE__)
Chris@909 2
Chris@909 3 class GanttsControllerTest < ActionController::TestCase
Chris@909 4 fixtures :projects, :trackers, :issue_statuses, :issues,
Chris@909 5 :enumerations, :users, :issue_categories,
Chris@909 6 :projects_trackers,
Chris@909 7 :roles,
Chris@909 8 :member_roles,
Chris@909 9 :members,
Chris@909 10 :enabled_modules,
Chris@909 11 :workflows,
Chris@909 12 :versions
Chris@909 13
Chris@909 14 context "#gantt" do
Chris@909 15 should "work" do
Chris@909 16 i2 = Issue.find(2)
Chris@909 17 i2.update_attribute(:due_date, 1.month.from_now)
Chris@909 18
Chris@909 19 get :show, :project_id => 1
Chris@909 20 assert_response :success
Chris@909 21 assert_template 'gantts/show'
Chris@909 22 assert_not_nil assigns(:gantt)
Chris@909 23 # Issue with start and due dates
Chris@909 24 i = Issue.find(1)
Chris@909 25 assert_not_nil i.due_date
Chris@909 26 assert_select "div a.issue", /##{i.id}/
Chris@909 27 # Issue with on a targeted version should not be in the events but loaded in the html
Chris@909 28 i = Issue.find(2)
Chris@909 29 assert_select "div a.issue", /##{i.id}/
Chris@909 30 end
Chris@909 31
Chris@909 32 should "work without issue due dates" do
Chris@909 33 Issue.update_all("due_date = NULL")
Chris@909 34
Chris@909 35 get :show, :project_id => 1
Chris@909 36 assert_response :success
Chris@909 37 assert_template 'gantts/show'
Chris@909 38 assert_not_nil assigns(:gantt)
Chris@909 39 end
Chris@909 40
Chris@909 41 should "work without issue and version due dates" do
Chris@909 42 Issue.update_all("due_date = NULL")
Chris@909 43 Version.update_all("effective_date = NULL")
Chris@909 44
Chris@909 45 get :show, :project_id => 1
Chris@909 46 assert_response :success
Chris@909 47 assert_template 'gantts/show'
Chris@909 48 assert_not_nil assigns(:gantt)
Chris@909 49 end
Chris@909 50
Chris@909 51 should "work cross project" do
Chris@909 52 get :show
Chris@909 53 assert_response :success
Chris@909 54 assert_template 'gantts/show'
Chris@909 55 assert_not_nil assigns(:gantt)
Chris@909 56 assert_not_nil assigns(:gantt).query
Chris@909 57 assert_nil assigns(:gantt).project
Chris@909 58 end
Chris@909 59
Chris@909 60 should "not disclose private projects" do
Chris@909 61 get :show
Chris@909 62 assert_response :success
Chris@909 63 assert_template 'gantts/show'
Chris@909 64
Chris@909 65 assert_tag 'a', :content => /eCookbook/
Chris@909 66 # Root private project
Chris@909 67 assert_no_tag 'a', {:content => /OnlineStore/}
Chris@909 68 # Private children of a public project
Chris@909 69 assert_no_tag 'a', :content => /Private child of eCookbook/
Chris@909 70 end
Chris@909 71
Chris@909 72 should "export to pdf" do
Chris@909 73 get :show, :project_id => 1, :format => 'pdf'
Chris@909 74 assert_response :success
Chris@909 75 assert_equal 'application/pdf', @response.content_type
Chris@909 76 assert @response.body.starts_with?('%PDF')
Chris@909 77 assert_not_nil assigns(:gantt)
Chris@909 78 end
Chris@909 79
Chris@909 80 should "export to pdf cross project" do
Chris@909 81 get :show, :format => 'pdf'
Chris@909 82 assert_response :success
Chris@909 83 assert_equal 'application/pdf', @response.content_type
Chris@909 84 assert @response.body.starts_with?('%PDF')
Chris@909 85 assert_not_nil assigns(:gantt)
Chris@909 86 end
Chris@909 87
Chris@909 88 should "export to png" do
Chris@909 89 get :show, :project_id => 1, :format => 'png'
Chris@909 90 assert_response :success
Chris@909 91 assert_equal 'image/png', @response.content_type
Chris@909 92 end if Object.const_defined?(:Magick)
Chris@909 93
Chris@909 94 end
Chris@909 95 end