annotate .svn/pristine/18/1885ce921d043d16f90840164f06199bb85e23a9.svn-base @ 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
rev   line source
Chris@909 1 require File.expand_path('../../test_helper', __FILE__)
Chris@909 2
Chris@909 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@909 16
Chris@909 17 def test_project_index
Chris@909 18 get :index, :id => 1, :with_subprojects => 0
Chris@909 19 assert_response :success
Chris@909 20 assert_template 'index'
Chris@909 21 assert_not_nil assigns(:events_by_day)
Chris@909 22
Chris@909 23 assert_tag :tag => "h3",
Chris@909 24 :content => /#{2.days.ago.to_date.day}/,
Chris@909 25 :sibling => { :tag => "dl",
Chris@909 26 :child => { :tag => "dt",
Chris@909 27 :attributes => { :class => /issue-edit/ },
Chris@909 28 :child => { :tag => "a",
Chris@909 29 :content => /(#{IssueStatus.find(2).name})/,
Chris@909 30 }
Chris@909 31 }
Chris@909 32 }
Chris@909 33 end
Chris@909 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@909 40 def test_previous_project_index
Chris@909 41 get :index, :id => 1, :from => 3.days.ago.to_date
Chris@909 42 assert_response :success
Chris@909 43 assert_template 'index'
Chris@909 44 assert_not_nil assigns(:events_by_day)
Chris@909 45
Chris@909 46 assert_tag :tag => "h3",
Chris@909 47 :content => /#{3.day.ago.to_date.day}/,
Chris@909 48 :sibling => { :tag => "dl",
Chris@909 49 :child => { :tag => "dt",
Chris@909 50 :attributes => { :class => /issue/ },
Chris@909 51 :child => { :tag => "a",
Chris@909 52 :content => /#{Issue.find(1).subject}/,
Chris@909 53 }
Chris@909 54 }
Chris@909 55 }
Chris@909 56 end
Chris@909 57
Chris@909 58 def test_global_index
Chris@909 59 get :index
Chris@909 60 assert_response :success
Chris@909 61 assert_template 'index'
Chris@909 62 assert_not_nil assigns(:events_by_day)
Chris@909 63
Chris@909 64 assert_tag :tag => "h3",
Chris@909 65 :content => /#{5.day.ago.to_date.day}/,
Chris@909 66 :sibling => { :tag => "dl",
Chris@909 67 :child => { :tag => "dt",
Chris@909 68 :attributes => { :class => /issue/ },
Chris@909 69 :child => { :tag => "a",
Chris@909 70 :content => /#{Issue.find(5).subject}/,
Chris@909 71 }
Chris@909 72 }
Chris@909 73 }
Chris@909 74 end
Chris@909 75
Chris@909 76 def test_user_index
Chris@909 77 get :index, :user_id => 2
Chris@909 78 assert_response :success
Chris@909 79 assert_template 'index'
Chris@909 80 assert_not_nil assigns(:events_by_day)
Chris@909 81
Chris@909 82 assert_tag :tag => "h3",
Chris@909 83 :content => /#{3.day.ago.to_date.day}/,
Chris@909 84 :sibling => { :tag => "dl",
Chris@909 85 :child => { :tag => "dt",
Chris@909 86 :attributes => { :class => /issue/ },
Chris@909 87 :child => { :tag => "a",
Chris@909 88 :content => /#{Issue.find(1).subject}/,
Chris@909 89 }
Chris@909 90 }
Chris@909 91 }
Chris@909 92 end
Chris@909 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@909 99 def test_index_atom_feed
Chris@909 100 get :index, :format => 'atom'
Chris@909 101 assert_response :success
Chris@909 102 assert_template 'common/feed.atom'
Chris@909 103 assert_tag :tag => 'entry', :child => {
Chris@909 104 :tag => 'link',
Chris@909 105 :attributes => {:href => 'http://test.host/issues/11'}}
Chris@909 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@909 114 end