annotate test/functional/activities_controller_test.rb @ 1082:997f6d7738f7 bug_531

In repo controller entry action, show the page for the file even if it's binary (so user still has access to history etc links). This makes it possible to use the entry action as the default when a file is clicked on
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 22 Nov 2012 18:04:17 +0000
parents cbb26bc654de
children 433d4f72a19b
rev   line source
Chris@119 1 require File.expand_path('../../test_helper', __FILE__)
chris@22 2
chris@22 3 class ActivitiesControllerTest < 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 :groups_users,
Chris@909 11 :enabled_modules,
Chris@909 12 :workflows,
Chris@909 13 :auth_sources,
Chris@909 14 :journals, :journal_details
Chris@909 15
chris@22 16
chris@22 17 def test_project_index
chris@22 18 get :index, :id => 1, :with_subprojects => 0
chris@22 19 assert_response :success
chris@22 20 assert_template 'index'
chris@22 21 assert_not_nil assigns(:events_by_day)
Chris@441 22
Chris@441 23 assert_tag :tag => "h3",
chris@22 24 :content => /#{2.days.ago.to_date.day}/,
chris@22 25 :sibling => { :tag => "dl",
chris@22 26 :child => { :tag => "dt",
chris@22 27 :attributes => { :class => /issue-edit/ },
chris@22 28 :child => { :tag => "a",
chris@22 29 :content => /(#{IssueStatus.find(2).name})/,
chris@22 30 }
chris@22 31 }
chris@22 32 }
chris@22 33 end
Chris@441 34
Chris@909 35 def test_project_index_with_invalid_project_id_should_respond_404
Chris@909 36 get :index, :id => 299
Chris@909 37 assert_response 404
Chris@909 38 end
Chris@909 39
chris@22 40 def test_previous_project_index
chris@22 41 get :index, :id => 1, :from => 3.days.ago.to_date
chris@22 42 assert_response :success
chris@22 43 assert_template 'index'
chris@22 44 assert_not_nil assigns(:events_by_day)
Chris@441 45
Chris@441 46 assert_tag :tag => "h3",
chris@22 47 :content => /#{3.day.ago.to_date.day}/,
chris@22 48 :sibling => { :tag => "dl",
chris@22 49 :child => { :tag => "dt",
chris@22 50 :attributes => { :class => /issue/ },
chris@22 51 :child => { :tag => "a",
chris@22 52 :content => /#{Issue.find(1).subject}/,
chris@22 53 }
chris@22 54 }
chris@22 55 }
chris@22 56 end
Chris@441 57
chris@22 58 def test_global_index
chris@22 59 get :index
chris@22 60 assert_response :success
chris@22 61 assert_template 'index'
chris@22 62 assert_not_nil assigns(:events_by_day)
Chris@441 63
Chris@441 64 assert_tag :tag => "h3",
chris@22 65 :content => /#{5.day.ago.to_date.day}/,
chris@22 66 :sibling => { :tag => "dl",
chris@22 67 :child => { :tag => "dt",
chris@22 68 :attributes => { :class => /issue/ },
chris@22 69 :child => { :tag => "a",
chris@22 70 :content => /#{Issue.find(5).subject}/,
chris@22 71 }
chris@22 72 }
chris@22 73 }
chris@22 74 end
Chris@441 75
chris@22 76 def test_user_index
chris@22 77 get :index, :user_id => 2
chris@22 78 assert_response :success
chris@22 79 assert_template 'index'
chris@22 80 assert_not_nil assigns(:events_by_day)
Chris@441 81
Chris@441 82 assert_tag :tag => "h3",
chris@22 83 :content => /#{3.day.ago.to_date.day}/,
chris@22 84 :sibling => { :tag => "dl",
chris@22 85 :child => { :tag => "dt",
chris@22 86 :attributes => { :class => /issue/ },
chris@22 87 :child => { :tag => "a",
chris@22 88 :content => /#{Issue.find(1).subject}/,
chris@22 89 }
chris@22 90 }
chris@22 91 }
chris@22 92 end
Chris@441 93
Chris@909 94 def test_user_index_with_invalid_user_id_should_respond_404
Chris@909 95 get :index, :user_id => 299
Chris@909 96 assert_response 404
Chris@909 97 end
Chris@909 98
chris@22 99 def test_index_atom_feed
chris@22 100 get :index, :format => 'atom'
chris@22 101 assert_response :success
Chris@909 102 assert_template 'common/feed.atom'
chris@22 103 assert_tag :tag => 'entry', :child => {
chris@22 104 :tag => 'link',
chris@22 105 :attributes => {:href => 'http://test.host/issues/11'}}
chris@22 106 end
Chris@909 107
Chris@909 108 def test_index_atom_feed_with_one_item_type
Chris@909 109 get :index, :format => 'atom', :show_issues => '1'
Chris@909 110 assert_response :success
Chris@909 111 assert_template 'common/feed.atom'
Chris@909 112 assert_tag :tag => 'title', :content => /Issues/
Chris@909 113 end
chris@22 114 end