annotate test/functional/gantts_controller_test.rb @ 8:0c83d98252d9 yuya

* Add custom repo prefix and proper auth realm, remove auth cache (seems like an unwise feature), pass DB handle around, various other bits of tidying
author Chris Cannam
date Thu, 12 Aug 2010 15:31:37 +0100
parents 513646585e45
children 1d32c0a0efbf
rev   line source
Chris@0 1 require 'test_helper'
Chris@0 2
Chris@0 3 class GanttsControllerTest < ActionController::TestCase
Chris@0 4 fixtures :all
Chris@0 5
Chris@0 6 context "#gantt" do
Chris@0 7 should "work" do
Chris@0 8 get :show, :project_id => 1
Chris@0 9 assert_response :success
Chris@0 10 assert_template 'show.html.erb'
Chris@0 11 assert_not_nil assigns(:gantt)
Chris@0 12 events = assigns(:gantt).events
Chris@0 13 assert_not_nil events
Chris@0 14 # Issue with start and due dates
Chris@0 15 i = Issue.find(1)
Chris@0 16 assert_not_nil i.due_date
Chris@0 17 assert events.include?(Issue.find(1))
Chris@0 18 # Issue with without due date but targeted to a version with date
Chris@0 19 i = Issue.find(2)
Chris@0 20 assert_nil i.due_date
Chris@0 21 assert events.include?(i)
Chris@0 22 end
Chris@0 23
Chris@0 24 should "work cross project" do
Chris@0 25 get :show
Chris@0 26 assert_response :success
Chris@0 27 assert_template 'show.html.erb'
Chris@0 28 assert_not_nil assigns(:gantt)
Chris@0 29 events = assigns(:gantt).events
Chris@0 30 assert_not_nil events
Chris@0 31 end
Chris@0 32
Chris@0 33 should "export to pdf" do
Chris@0 34 get :show, :project_id => 1, :format => 'pdf'
Chris@0 35 assert_response :success
Chris@0 36 assert_equal 'application/pdf', @response.content_type
Chris@0 37 assert @response.body.starts_with?('%PDF')
Chris@0 38 assert_not_nil assigns(:gantt)
Chris@0 39 end
Chris@0 40
Chris@0 41 should "export to pdf cross project" do
Chris@0 42 get :show, :format => 'pdf'
Chris@0 43 assert_response :success
Chris@0 44 assert_equal 'application/pdf', @response.content_type
Chris@0 45 assert @response.body.starts_with?('%PDF')
Chris@0 46 assert_not_nil assigns(:gantt)
Chris@0 47 end
Chris@0 48
Chris@0 49 should "export to png" do
Chris@0 50 get :show, :project_id => 1, :format => 'png'
Chris@0 51 assert_response :success
Chris@0 52 assert_equal 'image/png', @response.content_type
Chris@0 53 end if Object.const_defined?(:Magick)
Chris@0 54
Chris@0 55 end
Chris@0 56 end