2010-12-13 02:24:34 +03:00
|
|
|
require File.expand_path('../../test_helper', __FILE__)
|
2010-08-27 18:05:54 +04:00
|
|
|
|
|
|
|
class ActivitiesControllerTest < ActionController::TestCase
|
2011-09-24 08:20:08 +04:00
|
|
|
fixtures :projects, :trackers, :issue_statuses, :issues,
|
|
|
|
:enumerations, :users, :issue_categories,
|
|
|
|
:projects_trackers,
|
|
|
|
:roles,
|
|
|
|
:member_roles,
|
|
|
|
:members,
|
|
|
|
:groups_users,
|
|
|
|
:enabled_modules,
|
|
|
|
:workflows,
|
|
|
|
:auth_sources,
|
|
|
|
:journals, :journal_details
|
|
|
|
|
2010-08-27 18:05:54 +04:00
|
|
|
|
|
|
|
def test_project_index
|
|
|
|
get :index, :id => 1, :with_subprojects => 0
|
|
|
|
assert_response :success
|
|
|
|
assert_template 'index'
|
|
|
|
assert_not_nil assigns(:events_by_day)
|
2011-05-16 04:09:58 +04:00
|
|
|
|
|
|
|
assert_tag :tag => "h3",
|
2010-08-27 18:05:54 +04:00
|
|
|
:content => /#{2.days.ago.to_date.day}/,
|
|
|
|
:sibling => { :tag => "dl",
|
|
|
|
:child => { :tag => "dt",
|
|
|
|
:attributes => { :class => /issue-edit/ },
|
|
|
|
:child => { :tag => "a",
|
|
|
|
:content => /(#{IssueStatus.find(2).name})/,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
2011-05-16 04:09:58 +04:00
|
|
|
|
2011-11-29 23:57:07 +04:00
|
|
|
def test_project_index_with_invalid_project_id_should_respond_404
|
|
|
|
get :index, :id => 299
|
|
|
|
assert_response 404
|
|
|
|
end
|
|
|
|
|
2010-08-27 18:05:54 +04:00
|
|
|
def test_previous_project_index
|
|
|
|
get :index, :id => 1, :from => 3.days.ago.to_date
|
|
|
|
assert_response :success
|
|
|
|
assert_template 'index'
|
|
|
|
assert_not_nil assigns(:events_by_day)
|
2011-05-16 04:09:58 +04:00
|
|
|
|
|
|
|
assert_tag :tag => "h3",
|
2010-08-27 18:05:54 +04:00
|
|
|
:content => /#{3.day.ago.to_date.day}/,
|
|
|
|
:sibling => { :tag => "dl",
|
|
|
|
:child => { :tag => "dt",
|
|
|
|
:attributes => { :class => /issue/ },
|
|
|
|
:child => { :tag => "a",
|
|
|
|
:content => /#{Issue.find(1).subject}/,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
2011-05-16 04:09:58 +04:00
|
|
|
|
2010-08-27 18:05:54 +04:00
|
|
|
def test_global_index
|
|
|
|
get :index
|
|
|
|
assert_response :success
|
|
|
|
assert_template 'index'
|
|
|
|
assert_not_nil assigns(:events_by_day)
|
2011-05-16 04:09:58 +04:00
|
|
|
|
|
|
|
assert_tag :tag => "h3",
|
2010-08-27 18:05:54 +04:00
|
|
|
:content => /#{5.day.ago.to_date.day}/,
|
|
|
|
:sibling => { :tag => "dl",
|
|
|
|
:child => { :tag => "dt",
|
|
|
|
:attributes => { :class => /issue/ },
|
|
|
|
:child => { :tag => "a",
|
|
|
|
:content => /#{Issue.find(5).subject}/,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
2011-05-16 04:09:58 +04:00
|
|
|
|
2010-08-27 18:05:54 +04:00
|
|
|
def test_user_index
|
|
|
|
get :index, :user_id => 2
|
|
|
|
assert_response :success
|
|
|
|
assert_template 'index'
|
|
|
|
assert_not_nil assigns(:events_by_day)
|
2011-05-16 04:09:58 +04:00
|
|
|
|
|
|
|
assert_tag :tag => "h3",
|
2010-08-27 18:05:54 +04:00
|
|
|
:content => /#{3.day.ago.to_date.day}/,
|
|
|
|
:sibling => { :tag => "dl",
|
|
|
|
:child => { :tag => "dt",
|
|
|
|
:attributes => { :class => /issue/ },
|
|
|
|
:child => { :tag => "a",
|
|
|
|
:content => /#{Issue.find(1).subject}/,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
2011-05-16 04:09:58 +04:00
|
|
|
|
2011-11-29 23:57:07 +04:00
|
|
|
def test_user_index_with_invalid_user_id_should_respond_404
|
|
|
|
get :index, :user_id => 299
|
|
|
|
assert_response 404
|
|
|
|
end
|
|
|
|
|
2010-08-27 18:05:54 +04:00
|
|
|
def test_index_atom_feed
|
2012-01-14 20:08:51 +04:00
|
|
|
get :index, :format => 'atom', :with_subprojects => 0
|
2010-08-27 18:05:54 +04:00
|
|
|
assert_response :success
|
2011-09-24 08:19:26 +04:00
|
|
|
assert_template 'common/feed.atom'
|
2012-01-14 20:08:51 +04:00
|
|
|
|
|
|
|
assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil },
|
|
|
|
:attributes => {:rel => 'self', :href => 'http://test.host/activity.atom?with_subprojects=0'}
|
|
|
|
assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil },
|
|
|
|
:attributes => {:rel => 'alternate', :href => 'http://test.host/activity?with_subprojects=0'}
|
|
|
|
|
|
|
|
assert_tag :tag => 'entry', :child => {
|
|
|
|
:tag => 'link',
|
|
|
|
:attributes => {:href => 'http://test.host/issues/11'}}
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_index_atom_feed_with_explicit_selection
|
|
|
|
get :index, :format => 'atom', :with_subprojects => 0,
|
|
|
|
:show_changesets => 1,
|
|
|
|
:show_documents => 1,
|
|
|
|
:show_files => 1,
|
|
|
|
:show_issues => 1,
|
|
|
|
:show_messages => 1,
|
|
|
|
:show_news => 1,
|
|
|
|
:show_time_entries => 1,
|
|
|
|
:show_wiki_edits => 1
|
|
|
|
|
|
|
|
assert_response :success
|
|
|
|
assert_template 'common/feed.atom'
|
|
|
|
|
|
|
|
assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil },
|
|
|
|
:attributes => {:rel => 'self', :href => 'http://test.host/activity.atom?show_changesets=1&show_documents=1&show_files=1&show_issues=1&show_messages=1&show_news=1&show_time_entries=1&show_wiki_edits=1&with_subprojects=0'}
|
|
|
|
assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil },
|
|
|
|
:attributes => {:rel => 'alternate', :href => 'http://test.host/activity?show_changesets=1&show_documents=1&show_files=1&show_issues=1&show_messages=1&show_news=1&show_time_entries=1&show_wiki_edits=1&with_subprojects=0'}
|
|
|
|
|
2010-08-27 18:05:54 +04:00
|
|
|
assert_tag :tag => 'entry', :child => {
|
|
|
|
:tag => 'link',
|
|
|
|
:attributes => {:href => 'http://test.host/issues/11'}}
|
|
|
|
end
|
2011-11-29 23:57:07 +04:00
|
|
|
|
|
|
|
def test_index_atom_feed_with_one_item_type
|
|
|
|
get :index, :format => 'atom', :show_issues => '1'
|
|
|
|
assert_response :success
|
|
|
|
assert_template 'common/feed.atom'
|
|
|
|
assert_tag :tag => 'title', :content => /Issues/
|
|
|
|
end
|
2010-08-27 18:05:54 +04:00
|
|
|
end
|