commit
2bfc7aa93f
@ -0,0 +1,5 @@
|
|||||||
|
class ContestNotificationController
|
||||||
|
def show
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,3 @@
|
|||||||
|
class ContestNotification < ActiveRecord::Base
|
||||||
|
attr_accessible :content, :title
|
||||||
|
end
|
@ -0,0 +1,4 @@
|
|||||||
|
class OptionNumber < ActiveRecord::Base
|
||||||
|
attr_accessible :attachment, :changeset, :document, :follow, :issue_done_ratio, :issues_status, :memo, :messages_for_issues, :post_issue, :praise_by_one, :praise_by_three, :praise_by_two, :replay_for_memo, :replay_for_message, :score_type, :total_score, :tread, :tread_by_one, :tread_by_three, :tread_by_two, :user_id
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,47 @@
|
|||||||
|
<% @nav_dispaly_project_label = 1
|
||||||
|
@nav_dispaly_forum_label = 1 %>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="<%= current_language %>">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title><%=h html_title %></title>
|
||||||
|
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||||
|
<meta name="keywords" content="issue,bug,tracker" />
|
||||||
|
<%= csrf_meta_tag %>
|
||||||
|
<%= favicon %>
|
||||||
|
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
||||||
|
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||||
|
<%= javascript_heads %>
|
||||||
|
<%= javascript_include_tag "jquery.leanModal.min" %>
|
||||||
|
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
|
||||||
|
<%= heads_for_theme %>
|
||||||
|
<%= call_hook :view_layouts_base_html_head %>
|
||||||
|
<!-- page specific tags -->
|
||||||
|
<%= yield :header_tags -%>
|
||||||
|
</head>
|
||||||
|
<body class="<%=h body_css_classes %>">
|
||||||
|
<div id="wrapper">
|
||||||
|
<div id="wrapper2">
|
||||||
|
<div id="wrapper3">
|
||||||
|
<%=render :partial => 'layouts/base_header'%>
|
||||||
|
<div id="main" class="nosidebar">
|
||||||
|
<div id="content_">
|
||||||
|
<%= render_flash_messages %>
|
||||||
|
<%= yield %>
|
||||||
|
<%= call_hook :view_layouts_base_content %>
|
||||||
|
<div style="clear:both;"></div>
|
||||||
|
<%=render :partial => 'layouts/base_footer'%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
|
||||||
|
<div id="ajax-modal" style="display:none;"></div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%= call_hook :view_layouts_base_body_bottom %>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,50 @@
|
|||||||
|
<% @nav_dispaly_home_path_label = 1
|
||||||
|
@nav_dispaly_main_course_label = 1
|
||||||
|
@nav_dispaly_main_project_label = 1
|
||||||
|
@nav_dispaly_main_contest_label = 1 %>
|
||||||
|
<% @nav_dispaly_forum_label = 1%>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="<%= current_language %>">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title><%=h html_title %></title>
|
||||||
|
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||||
|
<meta name="keywords" content="issue,bug,tracker" />
|
||||||
|
<%= csrf_meta_tag %>
|
||||||
|
<%= favicon %>
|
||||||
|
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
||||||
|
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||||
|
<%= javascript_heads %>
|
||||||
|
<%= javascript_include_tag "jquery.leanModal.min" %>
|
||||||
|
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
|
||||||
|
<%= heads_for_theme %>
|
||||||
|
<%= call_hook :view_layouts_base_html_head %>
|
||||||
|
<!-- page specific tags -->
|
||||||
|
<%= yield :header_tags -%>
|
||||||
|
</head>
|
||||||
|
<body class="<%=h body_css_classes %>">
|
||||||
|
<div id="wrapper">
|
||||||
|
<div id="wrapper2">
|
||||||
|
<div id="wrapper3">
|
||||||
|
<%=render :partial => 'layouts/base_header'%>
|
||||||
|
<div id="main" class="nosidebar">
|
||||||
|
<div id="content_">
|
||||||
|
<%= render_flash_messages %>
|
||||||
|
<%= yield %>
|
||||||
|
<%= call_hook :view_layouts_base_content %>
|
||||||
|
<div style="clear:both;"></div>
|
||||||
|
<%=render :partial => 'layouts/base_footer'%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
|
||||||
|
<div id="ajax-modal" style="display:none;"></div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%= call_hook :view_layouts_base_body_bottom %>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,10 @@
|
|||||||
|
class CreateContestNotifications < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :contest_notifications do |t|
|
||||||
|
t.text :title
|
||||||
|
t.text :content
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,19 @@
|
|||||||
|
# -*coding:utf-8 -*-
|
||||||
|
class SetNotification < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
notifications = ContestNotification.all
|
||||||
|
if notifications.nil? || notifications.count == 0
|
||||||
|
notification = ContestNotification.new
|
||||||
|
notification.title = "2014年Android程序设计大赛获奖名单"
|
||||||
|
notification.content = "<div><span style='color: red'>一等奖:</span> <span style='color: #1166AD'>消灭那怪兽</span></div>
|
||||||
|
<div><span style='color: red'>二等奖:</span> <span style='color: #1166AD'>兄弟向前冲 </span></div>
|
||||||
|
<div><span style='color: red'>二等奖:</span> <span style='color: #1166AD'>鸟鸟文件管理器(银河之光版)</span></div>
|
||||||
|
<div><span style='color: red'>三等奖:</span> <span style='color: #1166AD'>疯狂猜图</span></div>
|
||||||
|
<div><span style='color: red'>三等奖:</span> <span style='color: #1166AD'>愉快的定向越野 </span></div>
|
||||||
|
<div><span style='color: red'>三等奖:</span> <span style='color: #1166AD'>体能训练助手 </span></div>
|
||||||
|
<div><span style='color: red'>三等奖:</span> <span style='color: #1166AD'>迷你日记本 </span></div>
|
||||||
|
<div><span style='color: red'>三等奖:</span> <span style='color: #1166AD'>永齐飞机大战</span></div>"
|
||||||
|
notification.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,29 @@
|
|||||||
|
class CreateOptionNumbers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :option_numbers do |t|
|
||||||
|
t.string :user_id
|
||||||
|
t.integer :memo
|
||||||
|
t.integer :messages_for_issues
|
||||||
|
t.integer :issues_status
|
||||||
|
t.integer :replay_for_message
|
||||||
|
t.integer :replay_for_memo
|
||||||
|
t.integer :follow
|
||||||
|
t.integer :tread
|
||||||
|
t.integer :praise_by_one
|
||||||
|
t.integer :praise_by_two
|
||||||
|
t.integer :praise_by_three
|
||||||
|
t.integer :tread_by_one
|
||||||
|
t.integer :tread_by_two
|
||||||
|
t.integer :tread_by_three
|
||||||
|
t.integer :changeset
|
||||||
|
t.integer :document
|
||||||
|
t.integer :attachment
|
||||||
|
t.integer :issue_done_ratio
|
||||||
|
t.integer :post_issue
|
||||||
|
t.integer :score_type
|
||||||
|
t.integer :total_score
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,6 @@
|
|||||||
|
class ChangeOptionNumber < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
change_column("option_numbers","user_id",:integer)
|
||||||
|
add_column("option_numbers","project_id",:integer)
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class AlterFirstPage < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
change_column("first_pages","description",:text)
|
||||||
|
end
|
||||||
|
end
|
Binary file not shown.
@ -0,0 +1,9 @@
|
|||||||
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
title: MyString
|
||||||
|
content: MyString
|
||||||
|
|
||||||
|
two:
|
||||||
|
title: MyString
|
||||||
|
content: MyString
|
@ -0,0 +1,47 @@
|
|||||||
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
user_id: MyString
|
||||||
|
memo: 1
|
||||||
|
messages_for_issues: 1
|
||||||
|
issues_status: 1
|
||||||
|
replay_for_message: 1
|
||||||
|
replay_for_memo: 1
|
||||||
|
follow: 1
|
||||||
|
tread: 1
|
||||||
|
praise_by_one: 1
|
||||||
|
praise_by_two: 1
|
||||||
|
praise_by_three: 1
|
||||||
|
tread_by_one: 1
|
||||||
|
tread_by_two: 1
|
||||||
|
tread_by_three: 1
|
||||||
|
changeset: 1
|
||||||
|
document: 1
|
||||||
|
attachment: 1
|
||||||
|
issue_done_ratio: 1
|
||||||
|
post_issue: 1
|
||||||
|
score_type: 1
|
||||||
|
total_score: 1
|
||||||
|
|
||||||
|
two:
|
||||||
|
user_id: MyString
|
||||||
|
memo: 1
|
||||||
|
messages_for_issues: 1
|
||||||
|
issues_status: 1
|
||||||
|
replay_for_message: 1
|
||||||
|
replay_for_memo: 1
|
||||||
|
follow: 1
|
||||||
|
tread: 1
|
||||||
|
praise_by_one: 1
|
||||||
|
praise_by_two: 1
|
||||||
|
praise_by_three: 1
|
||||||
|
tread_by_one: 1
|
||||||
|
tread_by_two: 1
|
||||||
|
tread_by_three: 1
|
||||||
|
changeset: 1
|
||||||
|
document: 1
|
||||||
|
attachment: 1
|
||||||
|
issue_done_ratio: 1
|
||||||
|
post_issue: 1
|
||||||
|
score_type: 1
|
||||||
|
total_score: 1
|
@ -0,0 +1,145 @@
|
|||||||
|
# Redmine - project management software
|
||||||
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
require File.expand_path('../../test_helper', __FILE__)
|
||||||
|
|
||||||
|
class IssueCategoriesControllerTest < ActionController::TestCase
|
||||||
|
fixtures :projects, :users, :members, :member_roles, :roles, :enabled_modules, :issue_categories,
|
||||||
|
:issues
|
||||||
|
|
||||||
|
def setup
|
||||||
|
User.current = nil
|
||||||
|
@request.session[:user_id] = 2
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_new
|
||||||
|
@request.session[:user_id] = 2 # manager
|
||||||
|
get :new, :project_id => '1'
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'new'
|
||||||
|
assert_select 'input[name=?]', 'issue_category[name]'
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_new_from_issue_form
|
||||||
|
@request.session[:user_id] = 2 # manager
|
||||||
|
xhr :get, :new, :project_id => '1'
|
||||||
|
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'new'
|
||||||
|
assert_equal 'text/javascript', response.content_type
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_create
|
||||||
|
@request.session[:user_id] = 2 # manager
|
||||||
|
assert_difference 'IssueCategory.count' do
|
||||||
|
post :create, :project_id => '1', :issue_category => {:name => 'New category'}
|
||||||
|
end
|
||||||
|
assert_redirected_to '/projects/ecookbook/settings/categories'
|
||||||
|
category = IssueCategory.find_by_name('New category')
|
||||||
|
assert_not_nil category
|
||||||
|
assert_equal 1, category.project_id
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_create_failure
|
||||||
|
@request.session[:user_id] = 2
|
||||||
|
post :create, :project_id => '1', :issue_category => {:name => ''}
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'new'
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_create_from_issue_form
|
||||||
|
@request.session[:user_id] = 2 # manager
|
||||||
|
assert_difference 'IssueCategory.count' do
|
||||||
|
xhr :post, :create, :project_id => '1', :issue_category => {:name => 'New category'}
|
||||||
|
end
|
||||||
|
category = IssueCategory.first(:order => 'id DESC')
|
||||||
|
assert_equal 'New category', category.name
|
||||||
|
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'create'
|
||||||
|
assert_equal 'text/javascript', response.content_type
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_create_from_issue_form_with_failure
|
||||||
|
@request.session[:user_id] = 2 # manager
|
||||||
|
assert_no_difference 'IssueCategory.count' do
|
||||||
|
xhr :post, :create, :project_id => '1', :issue_category => {:name => ''}
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'new'
|
||||||
|
assert_equal 'text/javascript', response.content_type
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_edit
|
||||||
|
@request.session[:user_id] = 2
|
||||||
|
get :edit, :id => 2
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'edit'
|
||||||
|
assert_select 'input[name=?][value=?]', 'issue_category[name]', 'Recipes'
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_update
|
||||||
|
assert_no_difference 'IssueCategory.count' do
|
||||||
|
put :update, :id => 2, :issue_category => { :name => 'Testing' }
|
||||||
|
end
|
||||||
|
assert_redirected_to '/projects/ecookbook/settings/categories'
|
||||||
|
assert_equal 'Testing', IssueCategory.find(2).name
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_update_failure
|
||||||
|
put :update, :id => 2, :issue_category => { :name => '' }
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'edit'
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_update_not_found
|
||||||
|
put :update, :id => 97, :issue_category => { :name => 'Testing' }
|
||||||
|
assert_response 404
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_destroy_category_not_in_use
|
||||||
|
delete :destroy, :id => 2
|
||||||
|
assert_redirected_to '/projects/ecookbook/settings/categories'
|
||||||
|
assert_nil IssueCategory.find_by_id(2)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_destroy_category_in_use
|
||||||
|
delete :destroy, :id => 1
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'destroy'
|
||||||
|
assert_not_nil IssueCategory.find_by_id(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_destroy_category_in_use_with_reassignment
|
||||||
|
issue = Issue.where(:category_id => 1).first
|
||||||
|
delete :destroy, :id => 1, :todo => 'reassign', :reassign_to_id => 2
|
||||||
|
assert_redirected_to '/projects/ecookbook/settings/categories'
|
||||||
|
assert_nil IssueCategory.find_by_id(1)
|
||||||
|
# check that the issue was reassign
|
||||||
|
assert_equal 2, issue.reload.category_id
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_destroy_category_in_use_without_reassignment
|
||||||
|
issue = Issue.where(:category_id => 1).first
|
||||||
|
delete :destroy, :id => 1, :todo => 'nullify'
|
||||||
|
assert_redirected_to '/projects/ecookbook/settings/categories'
|
||||||
|
assert_nil IssueCategory.find_by_id(1)
|
||||||
|
# check that the issue category was nullified
|
||||||
|
assert_nil issue.reload.category_id
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,147 @@
|
|||||||
|
# Redmine - project management software
|
||||||
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
require File.expand_path('../../test_helper', __FILE__)
|
||||||
|
|
||||||
|
class IssueRelationsControllerTest < ActionController::TestCase
|
||||||
|
fixtures :projects,
|
||||||
|
:users,
|
||||||
|
:roles,
|
||||||
|
:members,
|
||||||
|
:member_roles,
|
||||||
|
:issues,
|
||||||
|
:issue_statuses,
|
||||||
|
:issue_relations,
|
||||||
|
:enabled_modules,
|
||||||
|
:enumerations,
|
||||||
|
:trackers,
|
||||||
|
:projects_trackers
|
||||||
|
|
||||||
|
def setup
|
||||||
|
User.current = nil
|
||||||
|
@request.session[:user_id] = 3
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_create
|
||||||
|
assert_difference 'IssueRelation.count' do
|
||||||
|
post :create, :issue_id => 1,
|
||||||
|
:relation => {:issue_to_id => '2', :relation_type => 'relates', :delay => ''}
|
||||||
|
end
|
||||||
|
relation = IssueRelation.first(:order => 'id DESC')
|
||||||
|
assert_equal 1, relation.issue_from_id
|
||||||
|
assert_equal 2, relation.issue_to_id
|
||||||
|
assert_equal 'relates', relation.relation_type
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_create_xhr
|
||||||
|
assert_difference 'IssueRelation.count' do
|
||||||
|
xhr :post, :create, :issue_id => 3, :relation => {:issue_to_id => '1', :relation_type => 'relates', :delay => ''}
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'create'
|
||||||
|
assert_equal 'text/javascript', response.content_type
|
||||||
|
end
|
||||||
|
relation = IssueRelation.first(:order => 'id DESC')
|
||||||
|
assert_equal 3, relation.issue_from_id
|
||||||
|
assert_equal 1, relation.issue_to_id
|
||||||
|
|
||||||
|
assert_match /Bug #1/, response.body
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_create_should_accept_id_with_hash
|
||||||
|
assert_difference 'IssueRelation.count' do
|
||||||
|
post :create, :issue_id => 1,
|
||||||
|
:relation => {:issue_to_id => '#2', :relation_type => 'relates', :delay => ''}
|
||||||
|
end
|
||||||
|
relation = IssueRelation.first(:order => 'id DESC')
|
||||||
|
assert_equal 2, relation.issue_to_id
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_create_should_strip_id
|
||||||
|
assert_difference 'IssueRelation.count' do
|
||||||
|
post :create, :issue_id => 1,
|
||||||
|
:relation => {:issue_to_id => ' 2 ', :relation_type => 'relates', :delay => ''}
|
||||||
|
end
|
||||||
|
relation = IssueRelation.first(:order => 'id DESC')
|
||||||
|
assert_equal 2, relation.issue_to_id
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_create_should_not_break_with_non_numerical_id
|
||||||
|
assert_no_difference 'IssueRelation.count' do
|
||||||
|
assert_nothing_raised do
|
||||||
|
post :create, :issue_id => 1,
|
||||||
|
:relation => {:issue_to_id => 'foo', :relation_type => 'relates', :delay => ''}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_create_follows_relation_should_update_relations_list
|
||||||
|
issue1 = Issue.generate!(:subject => 'Followed issue', :start_date => Date.yesterday, :due_date => Date.today)
|
||||||
|
issue2 = Issue.generate!
|
||||||
|
|
||||||
|
assert_difference 'IssueRelation.count' do
|
||||||
|
xhr :post, :create, :issue_id => issue2.id,
|
||||||
|
:relation => {:issue_to_id => issue1.id, :relation_type => 'follows', :delay => ''}
|
||||||
|
end
|
||||||
|
assert_match /Followed issue/, response.body
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_should_create_relations_with_visible_issues_only
|
||||||
|
Setting.cross_project_issue_relations = '1'
|
||||||
|
assert_nil Issue.visible(User.find(3)).find_by_id(4)
|
||||||
|
|
||||||
|
assert_no_difference 'IssueRelation.count' do
|
||||||
|
post :create, :issue_id => 1,
|
||||||
|
:relation => {:issue_to_id => '4', :relation_type => 'relates', :delay => ''}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
should "prevent relation creation when there's a circular dependency"
|
||||||
|
|
||||||
|
def test_create_xhr_with_failure
|
||||||
|
assert_no_difference 'IssueRelation.count' do
|
||||||
|
xhr :post, :create, :issue_id => 3, :relation => {:issue_to_id => '999', :relation_type => 'relates', :delay => ''}
|
||||||
|
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'create'
|
||||||
|
assert_equal 'text/javascript', response.content_type
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_match /errorExplanation/, response.body
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_destroy
|
||||||
|
assert_difference 'IssueRelation.count', -1 do
|
||||||
|
delete :destroy, :id => '2'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_destroy_xhr
|
||||||
|
IssueRelation.create!(:relation_type => IssueRelation::TYPE_RELATES) do |r|
|
||||||
|
r.issue_from_id = 3
|
||||||
|
r.issue_to_id = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_difference 'IssueRelation.count', -1 do
|
||||||
|
xhr :delete, :destroy, :id => '2'
|
||||||
|
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'destroy'
|
||||||
|
assert_equal 'text/javascript', response.content_type
|
||||||
|
assert_match /relation-2/, response.body
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,123 @@
|
|||||||
|
# Redmine - project management software
|
||||||
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
require File.expand_path('../../test_helper', __FILE__)
|
||||||
|
|
||||||
|
class IssueStatusesControllerTest < ActionController::TestCase
|
||||||
|
fixtures :issue_statuses, :issues, :users
|
||||||
|
|
||||||
|
def setup
|
||||||
|
User.current = nil
|
||||||
|
@request.session[:user_id] = 1 # admin
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_index
|
||||||
|
get :index
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'index'
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_index_by_anonymous_should_redirect_to_login_form
|
||||||
|
@request.session[:user_id] = nil
|
||||||
|
get :index
|
||||||
|
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fissue_statuses'
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_index_by_user_should_respond_with_406
|
||||||
|
@request.session[:user_id] = 2
|
||||||
|
get :index
|
||||||
|
assert_response 406
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_new
|
||||||
|
get :new
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'new'
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_create
|
||||||
|
assert_difference 'IssueStatus.count' do
|
||||||
|
post :create, :issue_status => {:name => 'New status'}
|
||||||
|
end
|
||||||
|
assert_redirected_to :action => 'index'
|
||||||
|
status = IssueStatus.order('id DESC').first
|
||||||
|
assert_equal 'New status', status.name
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_create_with_failure
|
||||||
|
post :create, :issue_status => {:name => ''}
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'new'
|
||||||
|
assert_error_tag :content => /name can't be blank/i
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_edit
|
||||||
|
get :edit, :id => '3'
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'edit'
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_update
|
||||||
|
put :update, :id => '3', :issue_status => {:name => 'Renamed status'}
|
||||||
|
assert_redirected_to :action => 'index'
|
||||||
|
status = IssueStatus.find(3)
|
||||||
|
assert_equal 'Renamed status', status.name
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_update_with_failure
|
||||||
|
put :update, :id => '3', :issue_status => {:name => ''}
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'edit'
|
||||||
|
assert_error_tag :content => /name can't be blank/i
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_destroy
|
||||||
|
Issue.delete_all("status_id = 1")
|
||||||
|
|
||||||
|
assert_difference 'IssueStatus.count', -1 do
|
||||||
|
delete :destroy, :id => '1'
|
||||||
|
end
|
||||||
|
assert_redirected_to :action => 'index'
|
||||||
|
assert_nil IssueStatus.find_by_id(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_destroy_should_block_if_status_in_use
|
||||||
|
assert_not_nil Issue.find_by_status_id(1)
|
||||||
|
|
||||||
|
assert_no_difference 'IssueStatus.count' do
|
||||||
|
delete :destroy, :id => '1'
|
||||||
|
end
|
||||||
|
assert_redirected_to :action => 'index'
|
||||||
|
assert_not_nil IssueStatus.find_by_id(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_update_issue_done_ratio_with_issue_done_ratio_set_to_issue_field
|
||||||
|
with_settings :issue_done_ratio => 'issue_field' do
|
||||||
|
post :update_issue_done_ratio
|
||||||
|
assert_match /not updated/, flash[:error].to_s
|
||||||
|
assert_redirected_to '/issue_statuses'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_update_issue_done_ratio_with_issue_done_ratio_set_to_issue_status
|
||||||
|
with_settings :issue_done_ratio => 'issue_status' do
|
||||||
|
post :update_issue_done_ratio
|
||||||
|
assert_match /Issue done ratios updated/, flash[:notice].to_s
|
||||||
|
assert_redirected_to '/issue_statuses'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class ContestNotificationTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class OptionNumberTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
Loading…
Reference in new issue