##// END OF EJS Templates
Fixed that magic links to existing attachments are not converted when previewing issue notes....
Fixed that magic links to existing attachments are not converted when previewing issue notes. git-svn-id: http://svn.redmine.org/redmine/trunk@12476 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r11554:33afeea87a00
r12201:58a63c49c49b
Show More
versions_controller_test.rb
238 lines | 8.0 KiB | text/x-ruby | RubyLexer
/ test / functional / versions_controller_test.rb
Jean-Philippe Lang
Adds an option to view issues count by status on the version page (#7921)....
r5059 # Redmine - project management software
Jean-Philippe Lang
Copyright for 2013 (#12788)....
r10939 # Copyright (C) 2006-2013 Jean-Philippe Lang
Jean-Philippe Lang
Added version details view accessible from the roadmap....
r942 #
# 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.
Toshi MARUYAMA
remove trailing white-spaces from test/functional/versions_controller_test.rb....
r6507 #
Jean-Philippe Lang
Added version details view accessible from the roadmap....
r942 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces from test/functional/versions_controller_test.rb....
r6507 #
Jean-Philippe Lang
Added version details view accessible from the roadmap....
r942 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Jean-Baptiste Barth
Use absolute paths in test/**/* requires for Ruby 1.9.2 compatibility. #4050...
r4395 require File.expand_path('../../test_helper', __FILE__)
Jean-Philippe Lang
Added version details view accessible from the roadmap....
r942
Eric Davis
Upgraded to Rails 2.3.4 (#3597)...
r2773 class VersionsControllerTest < ActionController::TestCase
Toshi MARUYAMA
code layout clean up test/functional/versions_controller_test.rb...
r11544 fixtures :projects, :versions, :issues, :users, :roles, :members,
:member_roles, :enabled_modules, :issue_statuses,
:issue_categories
Toshi MARUYAMA
remove trailing white-spaces from test/functional/versions_controller_test.rb....
r6507
Jean-Philippe Lang
Added version details view accessible from the roadmap....
r942 def setup
User.current = nil
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/versions_controller_test.rb....
r6507
Eric Davis
Refactor: move method, ProjectsController#roadmap to VersionsController#index....
r3936 def test_index
get :index, :project_id => 1
assert_response :success
assert_template 'index'
assert_not_nil assigns(:versions)
# Version with no date set appears
assert assigns(:versions).include?(Version.find(3))
# Completed version doesn't appear
assert !assigns(:versions).include?(Version.find(1))
Jean-Baptiste Barth
Fixed broken context_menu on roadmap. #6351...
r3968 # Context menu on issues
Jean-Philippe Lang
JQuery in, Prototype/Scriptaculous out (#11445)....
r9885 assert_select "script", :text => Regexp.new(Regexp.escape("contextMenuInit('/issues/context_menu')"))
Toshi MARUYAMA
use assert_select instead of assert_tag at versions index sidebar...
r11554 assert_select "div#sidebar" do
# Links to versions anchors
assert_select 'a[href=?]', '#2.0'
# Links to completed versions in the sidebar
assert_select 'a[href=?]', '/versions/1'
end
Eric Davis
Refactor: move method, ProjectsController#roadmap to VersionsController#index....
r3936 end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/versions_controller_test.rb....
r6507
Eric Davis
Refactor: move method, ProjectsController#roadmap to VersionsController#index....
r3936 def test_index_with_completed_versions
get :index, :project_id => 1, :completed => 1
assert_response :success
assert_template 'index'
assert_not_nil assigns(:versions)
# Version with no date set appears
assert assigns(:versions).include?(Version.find(3))
# Completed version appears
assert assigns(:versions).include?(Version.find(1))
end
Jean-Philippe Lang
Tests/cleanup VersionsController....
r7918 def test_index_with_tracker_ids
get :index, :project_id => 1, :tracker_ids => [1, 3]
assert_response :success
assert_template 'index'
assert_not_nil assigns(:issues_by_version)
assert_nil assigns(:issues_by_version).values.flatten.detect {|issue| issue.tracker_id == 2}
end
Eric Davis
Refactor: move method, ProjectsController#roadmap to VersionsController#index....
r3936 def test_index_showing_subprojects_versions
Jean-Philippe Lang
Removed some generate! calls....
r8959 @subproject_version = Version.create!(:project => Project.find(3), :name => "Subproject version")
Eric Davis
Refactor: move method, ProjectsController#roadmap to VersionsController#index....
r3936 get :index, :project_id => 1, :with_subprojects => 1
assert_response :success
assert_template 'index'
assert_not_nil assigns(:versions)
assert assigns(:versions).include?(Version.find(4)), "Shared version not found"
assert assigns(:versions).include?(@subproject_version), "Subproject version not found"
end
Jean-Philippe Lang
Fixed that roadmap anchor links can be ambigous (#11540)....
r10017 def test_index_should_prepend_shared_versions
get :index, :project_id => 1
assert_response :success
assert_select '#sidebar' do
assert_select 'a[href=?]', '#2.0', :text => '2.0'
assert_select 'a[href=?]', '#subproject1-2.0', :text => 'eCookbook Subproject 1 - 2.0'
end
assert_select '#content' do
assert_select 'a[name=?]', '2.0', :text => '2.0'
assert_select 'a[name=?]', 'subproject1-2.0', :text => 'eCookbook Subproject 1 - 2.0'
end
end
Jean-Philippe Lang
Added version details view accessible from the roadmap....
r942 def test_show
get :show, :id => 2
assert_response :success
assert_template 'show'
assert_not_nil assigns(:version)
Toshi MARUYAMA
remove trailing white-spaces from test/functional/versions_controller_test.rb....
r6507
Jean-Philippe Lang
Added version details view accessible from the roadmap....
r942 assert_tag :tag => 'h2', :content => /1.0/
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/versions_controller_test.rb....
r6507
Jean-Philippe Lang
Issues by Category should show tasks without category (#8106)....
r10549 def test_show_should_display_nil_counts
with_settings :default_language => 'en' do
get :show, :id => 2, :status_by => 'category'
assert_response :success
assert_select 'div#status_by' do
assert_select 'select[name=status_by]' do
assert_select 'option[value=category][selected=selected]'
end
assert_select 'a', :text => 'none'
end
end
end
Jean-Philippe Lang
Tests/cleanup VersionsController....
r7918 def test_new
@request.session[:user_id] = 2
get :new, :project_id => '1'
assert_response :success
assert_template 'new'
end
Jean-Philippe Lang
Displays the full form when creating a version from the issue form so that required custom fields can be filled (#7398)....
r8725 def test_new_from_issue_form
@request.session[:user_id] = 2
xhr :get, :new, :project_id => '1'
assert_response :success
Jean-Philippe Lang
Start removing the RJS stuff....
r9860 assert_template 'new'
assert_equal 'text/javascript', response.content_type
Jean-Philippe Lang
Displays the full form when creating a version from the issue form so that required custom fields can be filled (#7398)....
r8725 end
Eric Davis
Refactor: split VersionsController#new into #new and #create...
r3976 def test_create
Jean-Philippe Lang
Moves ProjectsController#add_version to VersionsController#new....
r3434 @request.session[:user_id] = 2 # manager
assert_difference 'Version.count' do
Eric Davis
Refactor: split VersionsController#new into #new and #create...
r3976 post :create, :project_id => '1', :version => {:name => 'test_add_version'}
Jean-Philippe Lang
Moves ProjectsController#add_version to VersionsController#new....
r3434 end
assert_redirected_to '/projects/ecookbook/settings/versions'
version = Version.find_by_name('test_add_version')
assert_not_nil version
assert_equal 1, version.project_id
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/versions_controller_test.rb....
r6507
Eric Davis
Refactor: split VersionsController#new into #new and #create...
r3976 def test_create_from_issue_form
Jean-Philippe Lang
Displays the full form when creating a version from the issue form so that required custom fields can be filled (#7398)....
r8725 @request.session[:user_id] = 2
Jean-Philippe Lang
Moves ProjectsController#add_version to VersionsController#new....
r3434 assert_difference 'Version.count' do
Eric Davis
Refactor: split VersionsController#new into #new and #create...
r3976 xhr :post, :create, :project_id => '1', :version => {:name => 'test_add_version_from_issue_form'}
Jean-Philippe Lang
Moves ProjectsController#add_version to VersionsController#new....
r3434 end
version = Version.find_by_name('test_add_version_from_issue_form')
assert_not_nil version
assert_equal 1, version.project_id
Jean-Philippe Lang
Displays the full form when creating a version from the issue form so that required custom fields can be filled (#7398)....
r8725
assert_response :success
Jean-Philippe Lang
Start removing the RJS stuff....
r9860 assert_template 'create'
assert_equal 'text/javascript', response.content_type
Jean-Philippe Lang
Do not propose non-assignable version (#11506)....
r9904 assert_include 'test_add_version_from_issue_form', response.body
Jean-Philippe Lang
Displays the full form when creating a version from the issue form so that required custom fields can be filled (#7398)....
r8725 end
def test_create_from_issue_form_with_failure
@request.session[:user_id] = 2
assert_no_difference 'Version.count' do
xhr :post, :create, :project_id => '1', :version => {:name => ''}
end
assert_response :success
Jean-Philippe Lang
Start removing the RJS stuff....
r9860 assert_template 'new'
assert_equal 'text/javascript', response.content_type
Jean-Philippe Lang
Moves ProjectsController#add_version to VersionsController#new....
r3434 end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/versions_controller_test.rb....
r6507
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 def test_get_edit
@request.session[:user_id] = 2
get :edit, :id => 2
assert_response :success
assert_template 'edit'
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/versions_controller_test.rb....
r6507
Jean-Philippe Lang
Adds a link to automatically close completed versions in project settings (#1245)....
r2909 def test_close_completed
Version.update_all("status = 'open'")
@request.session[:user_id] = 2
Eric Davis
Refactor: convert VersionsController to a REST resource....
r3983 put :close_completed, :project_id => 'ecookbook'
Toshi MARUYAMA
code layout clean up test/functional/versions_controller_test.rb...
r11544 assert_redirected_to :controller => 'projects', :action => 'settings',
:tab => 'versions', :id => 'ecookbook'
Jean-Philippe Lang
Adds a link to automatically close completed versions in project settings (#1245)....
r2909 assert_not_nil Version.find_by_status('closed')
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/versions_controller_test.rb....
r6507
Eric Davis
Refactor: Split VersionsController#edit into #edit and #update...
r3974 def test_post_update
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 @request.session[:user_id] = 2
Toshi MARUYAMA
remove trailing white-spaces from test/functional/versions_controller_test.rb....
r6507 put :update, :id => 2,
Toshi MARUYAMA
code layout clean up test/functional/versions_controller_test.rb...
r11544 :version => {:name => 'New version name',
:effective_date => Date.today.strftime("%Y-%m-%d")}
assert_redirected_to :controller => 'projects', :action => 'settings',
:tab => 'versions', :id => 'ecookbook'
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 version = Version.find(2)
assert_equal 'New version name', version.name
assert_equal Date.today, version.effective_date
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/versions_controller_test.rb....
r6507
Jean-Philippe Lang
Fixed: "Template is missing" error when validation fails on version edit (#6766)....
r4240 def test_post_update_with_validation_failure
@request.session[:user_id] = 2
Toshi MARUYAMA
remove trailing white-spaces from test/functional/versions_controller_test.rb....
r6507 put :update, :id => 2,
:version => { :name => '',
Jean-Philippe Lang
Fixed: "Template is missing" error when validation fails on version edit (#6766)....
r4240 :effective_date => Date.today.strftime("%Y-%m-%d")}
assert_response :success
assert_template 'edit'
end
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974
def test_destroy
@request.session[:user_id] = 2
Jean-Philippe Lang
Tests/cleanup VersionsController....
r7918 assert_difference 'Version.count', -1 do
delete :destroy, :id => 3
end
Toshi MARUYAMA
code layout clean up test/functional/versions_controller_test.rb...
r11544 assert_redirected_to :controller => 'projects', :action => 'settings',
:tab => 'versions', :id => 'ecookbook'
Jean-Philippe Lang
Gantt chart: display issues that don't have a due date if they are assigned to a version with a date (#184)....
r1441 assert_nil Version.find_by_id(3)
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/versions_controller_test.rb....
r6507
Jean-Philippe Lang
Tests/cleanup VersionsController....
r7918 def test_destroy_version_in_use_should_fail
@request.session[:user_id] = 2
assert_no_difference 'Version.count' do
delete :destroy, :id => 2
end
Toshi MARUYAMA
code layout clean up test/functional/versions_controller_test.rb...
r11544 assert_redirected_to :controller => 'projects', :action => 'settings',
:tab => 'versions', :id => 'ecookbook'
Jean-Philippe Lang
Tests/cleanup VersionsController....
r7918 assert flash[:error].match(/Unable to delete version/)
assert Version.find_by_id(2)
end
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 def test_issue_status_by
xhr :get, :status_by, :id => 2
assert_response :success
Jean-Philippe Lang
Removes RJS from VersionsController....
r9869 assert_template 'status_by'
Jean-Philippe Lang
Added some functional tests and a CVS test repository....
r974 assert_template '_issue_counts'
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/versions_controller_test.rb....
r6507
Jean-Philippe Lang
Adds an option to view issues count by status on the version page (#7921)....
r5059 def test_issue_status_by_status
xhr :get, :status_by, :id => 2, :status_by => 'status'
assert_response :success
Jean-Philippe Lang
Removes RJS from VersionsController....
r9869 assert_template 'status_by'
Jean-Philippe Lang
Adds an option to view issues count by status on the version page (#7921)....
r5059 assert_template '_issue_counts'
Jean-Philippe Lang
Removes RJS from VersionsController....
r9869 assert_include 'Assigned', response.body
assert_include 'Closed', response.body
Jean-Philippe Lang
Adds an option to view issues count by status on the version page (#7921)....
r5059 end
Jean-Philippe Lang
Added version details view accessible from the roadmap....
r942 end