Revision 1298:4f746d8966dd .svn/pristine/27
| .svn/pristine/27/270c9debef33419abbdab93ac142c4646e6e19cf.svn-base | ||
|---|---|---|
| 1 |
# Redmine - project management software |
|
| 2 |
# Copyright (C) 2006-2013 Jean-Philippe Lang |
|
| 3 |
# |
|
| 4 |
# This program is free software; you can redistribute it and/or |
|
| 5 |
# modify it under the terms of the GNU General Public License |
|
| 6 |
# as published by the Free Software Foundation; either version 2 |
|
| 7 |
# of the License, or (at your option) any later version. |
|
| 8 |
# |
|
| 9 |
# This program is distributed in the hope that it will be useful, |
|
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 |
# GNU General Public License for more details. |
|
| 13 |
# |
|
| 14 |
# You should have received a copy of the GNU General Public License |
|
| 15 |
# along with this program; if not, write to the Free Software |
|
| 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
| 17 |
|
|
| 18 |
require File.expand_path('../../test_helper', __FILE__)
|
|
| 19 |
|
|
| 20 |
class ReportsControllerTest < ActionController::TestCase |
|
| 21 |
fixtures :projects, :trackers, :issue_statuses, :issues, |
|
| 22 |
:enumerations, :users, :issue_categories, |
|
| 23 |
:projects_trackers, |
|
| 24 |
:roles, |
|
| 25 |
:member_roles, |
|
| 26 |
:members, |
|
| 27 |
:enabled_modules, |
|
| 28 |
:versions |
|
| 29 |
|
|
| 30 |
def test_get_issue_report |
|
| 31 |
get :issue_report, :id => 1 |
|
| 32 |
|
|
| 33 |
assert_response :success |
|
| 34 |
assert_template 'issue_report' |
|
| 35 |
|
|
| 36 |
[:issues_by_tracker, :issues_by_version, :issues_by_category, :issues_by_assigned_to, |
|
| 37 |
:issues_by_author, :issues_by_subproject, :issues_by_priority].each do |ivar| |
|
| 38 |
assert_not_nil assigns(ivar) |
|
| 39 |
end |
|
| 40 |
|
|
| 41 |
assert_equal IssuePriority.all.reverse, assigns(:priorities) |
|
| 42 |
end |
|
| 43 |
|
|
| 44 |
def test_get_issue_report_details |
|
| 45 |
%w(tracker version priority category assigned_to author subproject).each do |detail| |
|
| 46 |
get :issue_report_details, :id => 1, :detail => detail |
|
| 47 |
|
|
| 48 |
assert_response :success |
|
| 49 |
assert_template 'issue_report_details' |
|
| 50 |
assert_not_nil assigns(:field) |
|
| 51 |
assert_not_nil assigns(:rows) |
|
| 52 |
assert_not_nil assigns(:data) |
|
| 53 |
assert_not_nil assigns(:report_title) |
|
| 54 |
end |
|
| 55 |
end |
|
| 56 |
|
|
| 57 |
def test_get_issue_report_details_by_priority |
|
| 58 |
get :issue_report_details, :id => 1, :detail => 'priority' |
|
| 59 |
assert_equal IssuePriority.all.reverse, assigns(:rows) |
|
| 60 |
end |
|
| 61 |
|
|
| 62 |
def test_get_issue_report_details_with_an_invalid_detail |
|
| 63 |
get :issue_report_details, :id => 1, :detail => 'invalid' |
|
| 64 |
|
|
| 65 |
assert_redirected_to '/projects/ecookbook/issues/report' |
|
| 66 |
end |
|
| 67 |
end |
|
| .svn/pristine/27/273ac825eb891aaec6af1c5e2e94f14d0663c303.svn-base | ||
|---|---|---|
| 1 |
module CodeRay |
|
| 2 |
module Encoders |
|
| 3 |
|
|
| 4 |
# = Debug Encoder |
|
| 5 |
# |
|
| 6 |
# Fast encoder producing simple debug output. |
|
| 7 |
# |
|
| 8 |
# It is readable and diff-able and is used for testing. |
|
| 9 |
# |
|
| 10 |
# You cannot fully restore the tokens information from the |
|
| 11 |
# output, because consecutive :space tokens are merged. |
|
| 12 |
# Use Tokens#dump for caching purposes. |
|
| 13 |
# |
|
| 14 |
# See also: Scanners::Debug |
|
| 15 |
class Debug < Encoder |
|
| 16 |
|
|
| 17 |
register_for :debug |
|
| 18 |
|
|
| 19 |
FILE_EXTENSION = 'raydebug' |
|
| 20 |
|
|
| 21 |
def initialize options = {}
|
|
| 22 |
super |
|
| 23 |
@opened = [] |
|
| 24 |
end |
|
| 25 |
|
|
| 26 |
def text_token text, kind |
|
| 27 |
if kind == :space |
|
| 28 |
@out << text |
|
| 29 |
else |
|
| 30 |
# TODO: Escape ( |
|
| 31 |
text = text.gsub(/[)\\]/, '\\\\\0') # escape ) and \ |
|
| 32 |
@out << kind.to_s << '(' << text << ')'
|
|
| 33 |
end |
|
| 34 |
end |
|
| 35 |
|
|
| 36 |
def begin_group kind |
|
| 37 |
@opened << kind |
|
| 38 |
@out << kind.to_s << '<' |
|
| 39 |
end |
|
| 40 |
|
|
| 41 |
def end_group kind |
|
| 42 |
if @opened.last != kind |
|
| 43 |
puts @out |
|
| 44 |
raise "we are inside #{@opened.inspect}, not #{kind}"
|
|
| 45 |
end |
|
| 46 |
@opened.pop |
|
| 47 |
@out << '>' |
|
| 48 |
end |
|
| 49 |
|
|
| 50 |
def begin_line kind |
|
| 51 |
@out << kind.to_s << '[' |
|
| 52 |
end |
|
| 53 |
|
|
| 54 |
def end_line kind |
|
| 55 |
@out << ']' |
|
| 56 |
end |
|
| 57 |
|
|
| 58 |
end |
|
| 59 |
|
|
| 60 |
end |
|
| 61 |
end |
|
| .svn/pristine/27/2745a50d7301c30263d5450e181481b6eeb6b406.svn-base | ||
|---|---|---|
| 1 |
# Redmine - project management software |
|
| 2 |
# Copyright (C) 2006-2013 Jean-Philippe Lang |
|
| 3 |
# |
|
| 4 |
# This program is free software; you can redistribute it and/or |
|
| 5 |
# modify it under the terms of the GNU General Public License |
|
| 6 |
# as published by the Free Software Foundation; either version 2 |
|
| 7 |
# of the License, or (at your option) any later version. |
|
| 8 |
# |
|
| 9 |
# This program is distributed in the hope that it will be useful, |
|
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 |
# GNU General Public License for more details. |
|
| 13 |
# |
|
| 14 |
# You should have received a copy of the GNU General Public License |
|
| 15 |
# along with this program; if not, write to the Free Software |
|
| 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
| 17 |
|
|
| 18 |
require File.expand_path('../../../../test_helper', __FILE__)
|
|
| 19 |
|
|
| 20 |
class Redmine::CipheringTest < ActiveSupport::TestCase |
|
| 21 |
|
|
| 22 |
def test_password_should_be_encrypted |
|
| 23 |
Redmine::Configuration.with 'database_cipher_key' => 'secret' do |
|
| 24 |
r = Repository::Subversion.create!(:password => 'foo', :url => 'file:///tmp', :identifier => 'svn') |
|
| 25 |
assert_equal 'foo', r.password |
|
| 26 |
assert r.read_attribute(:password).match(/\Aaes-256-cbc:.+\Z/) |
|
| 27 |
end |
|
| 28 |
end |
|
| 29 |
|
|
| 30 |
def test_password_should_be_clear_with_blank_key |
|
| 31 |
Redmine::Configuration.with 'database_cipher_key' => '' do |
|
| 32 |
r = Repository::Subversion.create!(:password => 'foo', :url => 'file:///tmp', :identifier => 'svn') |
|
| 33 |
assert_equal 'foo', r.password |
|
| 34 |
assert_equal 'foo', r.read_attribute(:password) |
|
| 35 |
end |
|
| 36 |
end |
|
| 37 |
|
|
| 38 |
def test_password_should_be_clear_with_nil_key |
|
| 39 |
Redmine::Configuration.with 'database_cipher_key' => nil do |
|
| 40 |
r = Repository::Subversion.create!(:password => 'foo', :url => 'file:///tmp', :identifier => 'svn') |
|
| 41 |
assert_equal 'foo', r.password |
|
| 42 |
assert_equal 'foo', r.read_attribute(:password) |
|
| 43 |
end |
|
| 44 |
end |
|
| 45 |
|
|
| 46 |
def test_blank_password_should_be_clear |
|
| 47 |
Redmine::Configuration.with 'database_cipher_key' => 'secret' do |
|
| 48 |
r = Repository::Subversion.create!(:password => '', :url => 'file:///tmp', :identifier => 'svn') |
|
| 49 |
assert_equal '', r.password |
|
| 50 |
assert_equal '', r.read_attribute(:password) |
|
| 51 |
end |
|
| 52 |
end |
|
| 53 |
|
|
| 54 |
def test_unciphered_password_should_be_readable |
|
| 55 |
Redmine::Configuration.with 'database_cipher_key' => nil do |
|
| 56 |
r = Repository::Subversion.create!(:password => 'clear', :url => 'file:///tmp', :identifier => 'svn') |
|
| 57 |
end |
|
| 58 |
|
|
| 59 |
Redmine::Configuration.with 'database_cipher_key' => 'secret' do |
|
| 60 |
r = Repository.first(:order => 'id DESC') |
|
| 61 |
assert_equal 'clear', r.password |
|
| 62 |
end |
|
| 63 |
end |
|
| 64 |
|
|
| 65 |
def test_ciphered_password_with_no_cipher_key_configured_should_be_returned_ciphered |
|
| 66 |
Redmine::Configuration.with 'database_cipher_key' => 'secret' do |
|
| 67 |
r = Repository::Subversion.create!(:password => 'clear', :url => 'file:///tmp', :identifier => 'svn') |
|
| 68 |
end |
|
| 69 |
|
|
| 70 |
Redmine::Configuration.with 'database_cipher_key' => '' do |
|
| 71 |
r = Repository.first(:order => 'id DESC') |
|
| 72 |
# password can not be deciphered |
|
| 73 |
assert_nothing_raised do |
|
| 74 |
assert r.password.match(/\Aaes-256-cbc:.+\Z/) |
|
| 75 |
end |
|
| 76 |
end |
|
| 77 |
end |
|
| 78 |
|
|
| 79 |
def test_encrypt_all |
|
| 80 |
Repository.delete_all |
|
| 81 |
Redmine::Configuration.with 'database_cipher_key' => nil do |
|
| 82 |
Repository::Subversion.create!(:password => 'foo', :url => 'file:///tmp', :identifier => 'foo') |
|
| 83 |
Repository::Subversion.create!(:password => 'bar', :url => 'file:///tmp', :identifier => 'bar') |
|
| 84 |
end |
|
| 85 |
|
|
| 86 |
Redmine::Configuration.with 'database_cipher_key' => 'secret' do |
|
| 87 |
assert Repository.encrypt_all(:password) |
|
| 88 |
r = Repository.first(:order => 'id DESC') |
|
| 89 |
assert_equal 'bar', r.password |
|
| 90 |
assert r.read_attribute(:password).match(/\Aaes-256-cbc:.+\Z/) |
|
| 91 |
end |
|
| 92 |
end |
|
| 93 |
|
|
| 94 |
def test_decrypt_all |
|
| 95 |
Repository.delete_all |
|
| 96 |
Redmine::Configuration.with 'database_cipher_key' => 'secret' do |
|
| 97 |
Repository::Subversion.create!(:password => 'foo', :url => 'file:///tmp', :identifier => 'foo') |
|
| 98 |
Repository::Subversion.create!(:password => 'bar', :url => 'file:///tmp', :identifier => 'bar') |
|
| 99 |
|
|
| 100 |
assert Repository.decrypt_all(:password) |
|
| 101 |
r = Repository.first(:order => 'id DESC') |
|
| 102 |
assert_equal 'bar', r.password |
|
| 103 |
assert_equal 'bar', r.read_attribute(:password) |
|
| 104 |
end |
|
| 105 |
end |
|
| 106 |
end |
|
| .svn/pristine/27/274f3b80c3fec339ad5a9fd2fdcdbd871a6ae2d1.svn-base | ||
|---|---|---|
| 1 |
# Redmine - project management software |
|
| 2 |
# Copyright (C) 2006-2013 Jean-Philippe Lang |
|
| 3 |
# |
|
| 4 |
# This program is free software; you can redistribute it and/or |
|
| 5 |
# modify it under the terms of the GNU General Public License |
|
| 6 |
# as published by the Free Software Foundation; either version 2 |
|
| 7 |
# of the License, or (at your option) any later version. |
|
| 8 |
# |
|
| 9 |
# This program is distributed in the hope that it will be useful, |
|
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 |
# GNU General Public License for more details. |
|
| 13 |
# |
|
| 14 |
# You should have received a copy of the GNU General Public License |
|
| 15 |
# along with this program; if not, write to the Free Software |
|
| 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
| 17 |
|
|
| 18 |
require File.expand_path('../../../../../../test_helper', __FILE__)
|
|
| 19 |
begin |
|
| 20 |
require 'mocha' |
|
| 21 |
|
|
| 22 |
class DarcsAdapterTest < ActiveSupport::TestCase |
|
| 23 |
REPOSITORY_PATH = Rails.root.join('tmp/test/darcs_repository').to_s
|
|
| 24 |
|
|
| 25 |
if File.directory?(REPOSITORY_PATH) |
|
| 26 |
def setup |
|
| 27 |
@adapter = Redmine::Scm::Adapters::DarcsAdapter.new(REPOSITORY_PATH) |
|
| 28 |
end |
|
| 29 |
|
|
| 30 |
def test_darcsversion |
|
| 31 |
to_test = { "1.0.9 (release)\n" => [1,0,9] ,
|
|
| 32 |
"2.2.0 (release)\n" => [2,2,0] } |
|
| 33 |
to_test.each do |s, v| |
|
| 34 |
test_darcsversion_for(s, v) |
|
| 35 |
end |
|
| 36 |
end |
|
| 37 |
|
|
| 38 |
def test_revisions |
|
| 39 |
id1 = '20080308225258-98289-761f654d669045eabee90b91b53a21ce5593cadf.gz' |
|
| 40 |
revs = @adapter.revisions('', nil, nil, {:with_path => true})
|
|
| 41 |
assert_equal 6, revs.size |
|
| 42 |
assert_equal id1, revs[5].scmid |
|
| 43 |
paths = revs[5].paths |
|
| 44 |
assert_equal 5, paths.size |
|
| 45 |
assert_equal 'A', paths[0][:action] |
|
| 46 |
assert_equal '/README', paths[0][:path] |
|
| 47 |
assert_equal 'A', paths[1][:action] |
|
| 48 |
assert_equal '/images', paths[1][:path] |
|
| 49 |
end |
|
| 50 |
|
|
| 51 |
private |
|
| 52 |
|
|
| 53 |
def test_darcsversion_for(darcsversion, version) |
|
| 54 |
@adapter.class.expects(:darcs_binary_version_from_command_line).returns(darcsversion) |
|
| 55 |
assert_equal version, @adapter.class.darcs_binary_version |
|
| 56 |
end |
|
| 57 |
|
|
| 58 |
else |
|
| 59 |
puts "Darcs test repository NOT FOUND. Skipping unit tests !!!" |
|
| 60 |
def test_fake; assert true end |
|
| 61 |
end |
|
| 62 |
end |
|
| 63 |
|
|
| 64 |
rescue LoadError |
|
| 65 |
class DarcsMochaFake < ActiveSupport::TestCase |
|
| 66 |
def test_fake; assert(false, "Requires mocha to run those tests") end |
|
| 67 |
end |
|
| 68 |
end |
|
| 69 |
|
|
| .svn/pristine/27/275a63d95374044297ed252103e82089ce4c9a74.svn-base | ||
|---|---|---|
| 1 |
# Redmine - project management software |
|
| 2 |
# Copyright (C) 2006-2011 Jean-Philippe Lang |
|
| 3 |
# |
|
| 4 |
# This program is free software; you can redistribute it and/or |
|
| 5 |
# modify it under the terms of the GNU General Public License |
|
| 6 |
# as published by the Free Software Foundation; either version 2 |
|
| 7 |
# of the License, or (at your option) any later version. |
|
| 8 |
# |
|
| 9 |
# This program is distributed in the hope that it will be useful, |
|
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 |
# GNU General Public License for more details. |
|
| 13 |
# |
|
| 14 |
# You should have received a copy of the GNU General Public License |
|
| 15 |
# along with this program; if not, write to the Free Software |
|
| 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
| 17 |
|
|
| 18 |
require File.expand_path('../../../test_helper', __FILE__)
|
|
| 19 |
|
|
| 20 |
class ApiTest::AttachmentsTest < ActionController::IntegrationTest |
|
| 21 |
fixtures :projects, :trackers, :issue_statuses, :issues, |
|
| 22 |
:enumerations, :users, :issue_categories, |
|
| 23 |
:projects_trackers, |
|
| 24 |
:roles, |
|
| 25 |
:member_roles, |
|
| 26 |
:members, |
|
| 27 |
:enabled_modules, |
|
| 28 |
:workflows, |
|
| 29 |
:attachments |
|
| 30 |
|
|
| 31 |
def setup |
|
| 32 |
Setting.rest_api_enabled = '1' |
|
| 33 |
Attachment.storage_path = "#{Rails.root}/test/fixtures/files"
|
|
| 34 |
end |
|
| 35 |
|
|
| 36 |
context "/attachments/:id" do |
|
| 37 |
context "GET" do |
|
| 38 |
should "return the attachment" do |
|
| 39 |
get '/attachments/7.xml', {}, :authorization => credentials('jsmith')
|
|
| 40 |
assert_response :success |
|
| 41 |
assert_equal 'application/xml', @response.content_type |
|
| 42 |
assert_tag :tag => 'attachment', |
|
| 43 |
:child => {
|
|
| 44 |
:tag => 'id', |
|
| 45 |
:content => '7', |
|
| 46 |
:sibling => {
|
|
| 47 |
:tag => 'filename', |
|
| 48 |
:content => 'archive.zip', |
|
| 49 |
:sibling => {
|
|
| 50 |
:tag => 'content_url', |
|
| 51 |
:content => 'http://www.example.com/attachments/download/7/archive.zip' |
|
| 52 |
} |
|
| 53 |
} |
|
| 54 |
} |
|
| 55 |
end |
|
| 56 |
|
|
| 57 |
should "deny access without credentials" do |
|
| 58 |
get '/attachments/7.xml' |
|
| 59 |
assert_response 401 |
|
| 60 |
set_tmp_attachments_directory |
|
| 61 |
end |
|
| 62 |
end |
|
| 63 |
end |
|
| 64 |
|
|
| 65 |
context "/attachments/download/:id/:filename" do |
|
| 66 |
context "GET" do |
|
| 67 |
should "return the attachment content" do |
|
| 68 |
get '/attachments/download/7/archive.zip', |
|
| 69 |
{}, :authorization => credentials('jsmith')
|
|
| 70 |
assert_response :success |
|
| 71 |
assert_equal 'application/octet-stream', @response.content_type |
|
| 72 |
set_tmp_attachments_directory |
|
| 73 |
end |
|
| 74 |
|
|
| 75 |
should "deny access without credentials" do |
|
| 76 |
get '/attachments/download/7/archive.zip' |
|
| 77 |
assert_response 302 |
|
| 78 |
set_tmp_attachments_directory |
|
| 79 |
end |
|
| 80 |
end |
|
| 81 |
end |
|
| 82 |
|
|
| 83 |
def credentials(user, password=nil) |
|
| 84 |
ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user) |
|
| 85 |
end |
|
| 86 |
end |
|
| .svn/pristine/27/27952988c7b2ad95ea1ef729436ace0c3896dd74.svn-base | ||
|---|---|---|
| 1 |
#!/usr/bin/env ruby |
|
| 2 |
|
|
| 3 |
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) |
|
| 4 |
|
|
| 5 |
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: |
|
| 6 |
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired |
|
| 7 |
require "dispatcher" |
|
| 8 |
|
|
| 9 |
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
|
|
| 10 |
Dispatcher.dispatch |
|
| .svn/pristine/27/2798cf8bdb60e5a48dc833a97dea5cc70e29382c.svn-base | ||
|---|---|---|
| 1 |
# Redmine - project management software |
|
| 2 |
# Copyright (C) 2006-2011 Jean-Philippe Lang |
|
| 3 |
# |
|
| 4 |
# This program is free software; you can redistribute it and/or |
|
| 5 |
# modify it under the terms of the GNU General Public License |
|
| 6 |
# as published by the Free Software Foundation; either version 2 |
|
| 7 |
# of the License, or (at your option) any later version. |
|
| 8 |
# |
|
| 9 |
# This program is distributed in the hope that it will be useful, |
|
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 |
# GNU General Public License for more details. |
|
| 13 |
# |
|
| 14 |
# You should have received a copy of the GNU General Public License |
|
| 15 |
# along with this program; if not, write to the Free Software |
|
| 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
| 17 |
|
|
| 18 |
require File.expand_path('../../../test_helper', __FILE__)
|
|
| 19 |
|
|
| 20 |
class ProjectsHelperTest < ActionView::TestCase |
|
| 21 |
include ApplicationHelper |
|
| 22 |
include ProjectsHelper |
|
| 23 |
|
|
| 24 |
fixtures :projects, :trackers, :issue_statuses, :issues, |
|
| 25 |
:enumerations, :users, :issue_categories, |
|
| 26 |
:versions, |
|
| 27 |
:projects_trackers, |
|
| 28 |
:member_roles, |
|
| 29 |
:members, |
|
| 30 |
:groups_users, |
|
| 31 |
:enabled_modules, |
|
| 32 |
:workflows |
|
| 33 |
|
|
| 34 |
def setup |
|
| 35 |
super |
|
| 36 |
set_language_if_valid('en')
|
|
| 37 |
User.current = nil |
|
| 38 |
end |
|
| 39 |
|
|
| 40 |
def test_link_to_version_within_project |
|
| 41 |
@project = Project.find(2) |
|
| 42 |
User.current = User.find(1) |
|
| 43 |
assert_equal '<a href="/versions/5">Alpha</a>', link_to_version(Version.find(5)) |
|
| 44 |
end |
|
| 45 |
|
|
| 46 |
def test_link_to_version |
|
| 47 |
User.current = User.find(1) |
|
| 48 |
assert_equal '<a href="/versions/5">OnlineStore - Alpha</a>', link_to_version(Version.find(5)) |
|
| 49 |
end |
|
| 50 |
|
|
| 51 |
def test_link_to_private_version |
|
| 52 |
assert_equal 'OnlineStore - Alpha', link_to_version(Version.find(5)) |
|
| 53 |
end |
|
| 54 |
|
|
| 55 |
def test_link_to_version_invalid_version |
|
| 56 |
assert_equal '', link_to_version(Object) |
|
| 57 |
end |
|
| 58 |
|
|
| 59 |
def test_format_version_name_within_project |
|
| 60 |
@project = Project.find(1) |
|
| 61 |
assert_equal "0.1", format_version_name(Version.find(1)) |
|
| 62 |
end |
|
| 63 |
|
|
| 64 |
def test_format_version_name |
|
| 65 |
assert_equal "eCookbook - 0.1", format_version_name(Version.find(1)) |
|
| 66 |
end |
|
| 67 |
|
|
| 68 |
def test_format_version_name_for_system_version |
|
| 69 |
assert_equal "OnlineStore - Systemwide visible version", format_version_name(Version.find(7)) |
|
| 70 |
end |
|
| 71 |
|
|
| 72 |
def test_version_options_for_select_with_no_versions |
|
| 73 |
assert_equal '', version_options_for_select([]) |
|
| 74 |
assert_equal '<option value="1" selected="selected">0.1</option>', version_options_for_select([], Version.find(1)) |
|
| 75 |
end |
|
| 76 |
end |
|
| .svn/pristine/27/27ca0e4d3dcbae405bcd6b8ff364b70b5542b197.svn-base | ||
|---|---|---|
| 1 |
# Redmine - project management software |
|
| 2 |
# Copyright (C) 2006-2011 Jean-Philippe Lang |
|
| 3 |
# |
|
| 4 |
# This program is free software; you can redistribute it and/or |
|
| 5 |
# modify it under the terms of the GNU General Public License |
|
| 6 |
# as published by the Free Software Foundation; either version 2 |
|
| 7 |
# of the License, or (at your option) any later version. |
|
| 8 |
# |
|
| 9 |
# This program is distributed in the hope that it will be useful, |
|
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 |
# GNU General Public License for more details. |
|
| 13 |
# |
|
| 14 |
# You should have received a copy of the GNU General Public License |
|
| 15 |
# along with this program; if not, write to the Free Software |
|
| 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
| 17 |
|
|
| 18 |
require File.expand_path('../../../test_helper', __FILE__)
|
|
| 19 |
|
|
| 20 |
class CustomFieldsHelperTest < ActionView::TestCase |
|
| 21 |
include CustomFieldsHelper |
|
| 22 |
include Redmine::I18n |
|
| 23 |
|
|
| 24 |
def test_format_boolean_value |
|
| 25 |
I18n.locale = 'en' |
|
| 26 |
assert_equal 'Yes', format_value('1', 'bool')
|
|
| 27 |
assert_equal 'No', format_value('0', 'bool')
|
|
| 28 |
end |
|
| 29 |
|
|
| 30 |
def test_unknow_field_format_should_be_edited_as_string |
|
| 31 |
field = CustomField.new(:field_format => 'foo') |
|
| 32 |
value = CustomValue.new(:value => 'bar', :custom_field => field) |
|
| 33 |
field.id = 52 |
|
| 34 |
|
|
| 35 |
assert_equal '<input id="object_custom_field_values_52" name="object[custom_field_values][52]" type="text" value="bar" />', |
|
| 36 |
custom_field_tag('object', value)
|
|
| 37 |
end |
|
| 38 |
|
|
| 39 |
def test_unknow_field_format_should_be_bulk_edited_as_string |
|
| 40 |
field = CustomField.new(:field_format => 'foo') |
|
| 41 |
field.id = 52 |
|
| 42 |
|
|
| 43 |
assert_equal '<input id="object_custom_field_values_52" name="object[custom_field_values][52]" type="text" value="" />', |
|
| 44 |
custom_field_tag_for_bulk_edit('object', field)
|
|
| 45 |
end |
|
| 46 |
end |
|
| .svn/pristine/27/27ce56818e709e285d3d63b2d5d116ba119243bf.svn-base | ||
|---|---|---|
| 1 |
class ChangeChangesetsRevisionToString < ActiveRecord::Migration |
|
| 2 |
def self.up |
|
| 3 |
# Some backends (eg. SQLServer 2012) do not support changing the type |
|
| 4 |
# of an indexed column so the index needs to be dropped first |
|
| 5 |
# BUT this index is renamed with some backends (at least SQLite3) for |
|
| 6 |
# some (unknown) reasons, thus we check for the other name as well |
|
| 7 |
# so we don't end up with 2 identical indexes |
|
| 8 |
if index_exists? :changesets, [:repository_id, :revision], :name => :changesets_repos_rev |
|
| 9 |
remove_index :changesets, :name => :changesets_repos_rev |
|
| 10 |
end |
|
| 11 |
if index_exists? :changesets, [:repository_id, :revision], :name => :altered_changesets_repos_rev |
|
| 12 |
remove_index :changesets, :name => :altered_changesets_repos_rev |
|
| 13 |
end |
|
| 14 |
|
|
| 15 |
change_column :changesets, :revision, :string, :null => false |
|
| 16 |
|
|
| 17 |
add_index :changesets, [:repository_id, :revision], :unique => true, :name => :changesets_repos_rev |
|
| 18 |
end |
|
| 19 |
|
|
| 20 |
def self.down |
|
| 21 |
if index_exists? :changesets, :changesets_repos_rev |
|
| 22 |
remove_index :changesets, :name => :changesets_repos_rev |
|
| 23 |
end |
|
| 24 |
if index_exists? :changesets, [:repository_id, :revision], :name => :altered_changesets_repos_rev |
|
| 25 |
remove_index :changesets, :name => :altered_changesets_repos_rev |
|
| 26 |
end |
|
| 27 |
|
|
| 28 |
change_column :changesets, :revision, :integer, :null => false |
|
| 29 |
|
|
| 30 |
add_index :changesets, [:repository_id, :revision], :unique => true, :name => :changesets_repos_rev |
|
| 31 |
end |
|
| 32 |
end |
|
| .svn/pristine/27/27ff0c8aa6059bb3d3244c9053898a1f8e9c2b1e.svn-base | ||
|---|---|---|
| 1 |
# Redmine - project management software |
|
| 2 |
# Copyright (C) 2006-2013 Jean-Philippe Lang |
|
| 3 |
# |
|
| 4 |
# This program is free software; you can redistribute it and/or |
|
| 5 |
# modify it under the terms of the GNU General Public License |
|
| 6 |
# as published by the Free Software Foundation; either version 2 |
|
| 7 |
# of the License, or (at your option) any later version. |
|
| 8 |
# |
|
| 9 |
# This program is distributed in the hope that it will be useful, |
|
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 12 |
# GNU General Public License for more details. |
|
| 13 |
# |
|
| 14 |
# You should have received a copy of the GNU General Public License |
|
| 15 |
# along with this program; if not, write to the Free Software |
|
| 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
| 17 |
|
|
| 18 |
module Redmine |
|
| 19 |
module Views |
|
| 20 |
module MyPage |
|
| 21 |
module Block |
|
| 22 |
def self.additional_blocks |
|
| 23 |
@@additional_blocks ||= Dir.glob("#{Redmine::Plugin.directory}/*/app/views/my/blocks/_*.{rhtml,erb}").inject({}) do |h,file|
|
|
| 24 |
name = File.basename(file).split('.').first.gsub(/^_/, '')
|
|
| 25 |
h[name] = name.to_sym |
|
| 26 |
h |
|
| 27 |
end |
|
| 28 |
end |
|
| 29 |
end |
|
| 30 |
end |
|
| 31 |
end |
|
| 32 |
end |
|
Also available in: Unified diff