2011-10-29 16:19:11 +04:00
|
|
|
#-- encoding: UTF-8
|
2011-05-30 00:11:52 +04:00
|
|
|
#-- copyright
|
|
|
|
# ChiliProject is a project management system.
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2012-01-03 23:36:40 +04:00
|
|
|
# Copyright (C) 2010-2012 the ChiliProject Team
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2011-05-30 00:11:52 +04:00
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2011-05-30 00:11:52 +04:00
|
|
|
# See doc/COPYRIGHT.rdoc for more details.
|
|
|
|
#++
|
|
|
|
|
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
|
|
|
|
fixtures :all
|
|
|
|
|
|
|
|
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-30 22:52:25 +04:00
|
|
|
|
|
|
|
assert_tag :tag => "h3",
|
2010-11-03 20:42:42 +03:00
|
|
|
:content => /#{1.day.ago.to_date.day}/,
|
2010-08-27 18:05:54 +04:00
|
|
|
:sibling => { :tag => "dl",
|
|
|
|
:child => { :tag => "dt",
|
2010-11-03 20:42:42 +03:00
|
|
|
:attributes => { :class => /issue/ },
|
2010-08-27 18:05:54 +04:00
|
|
|
:child => { :tag => "a",
|
|
|
|
:content => /(#{IssueStatus.find(2).name})/,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
2011-05-30 22:52:25 +04:00
|
|
|
|
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-30 22:52:25 +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-30 22:52:25 +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-30 22:52:25 +04:00
|
|
|
|
|
|
|
assert_tag :tag => "h3",
|
2010-11-03 20:42:42 +03:00
|
|
|
:content => /#{3.day.ago.to_date.day}/,
|
2010-08-27 18:05:54 +04:00
|
|
|
:sibling => { :tag => "dl",
|
|
|
|
:child => { :tag => "dt",
|
|
|
|
:attributes => { :class => /issue/ },
|
|
|
|
:child => { :tag => "a",
|
2010-11-03 20:42:42 +03:00
|
|
|
:content => /#{Issue.find(1).subject}/,
|
2010-08-27 18:05:54 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
2011-05-30 22:52:25 +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-30 22:52:25 +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-30 22:52:25 +04:00
|
|
|
|
2010-08-27 18:05:54 +04:00
|
|
|
def test_index_atom_feed
|
|
|
|
get :index, :format => 'atom'
|
|
|
|
assert_response :success
|
|
|
|
assert_template 'common/feed.atom.rxml'
|
|
|
|
assert_tag :tag => 'entry', :child => {
|
|
|
|
:tag => 'link',
|
|
|
|
:attributes => {:href => 'http://test.host/issues/11'}}
|
|
|
|
end
|
2011-05-30 22:52:25 +04:00
|
|
|
|
2012-03-28 22:31:20 +04:00
|
|
|
def test_index_without_filters
|
|
|
|
get :index, :set_filter => 1
|
|
|
|
assert_response :success
|
|
|
|
assert_template 'index'
|
|
|
|
assert_tag :tag => 'p',
|
|
|
|
:attributes => {:class => /nodata/},
|
|
|
|
:content => "No data to display"
|
|
|
|
end
|
2010-08-27 18:05:54 +04:00
|
|
|
end
|