diff --git a/Gemfile b/Gemfile index 9dae2827..400cdab3 100644 --- a/Gemfile +++ b/Gemfile @@ -42,6 +42,24 @@ group :ldap do gem "net-ldap", "~> 0.3.1" end +group :test do + # shoulda的版本做了改动 + #gem "shoulda", "~> 3.3.2" + gem "shoulda", "> 3.3.2" + gem "mocha", "~> 0.13.3" + gem 'capybara', '~> 2.0.0' + gem 'nokogiri', '< 1.6.0' +end + +platforms :mri, :mingw do + group :rmagick do + # RMagick 2 supports ruby 1.9 + # RMagick 1 would be fine for ruby 1.8 but Bundler does not support + # different requirements for the same gem on different platforms + gem "rmagick", ">= 2.0.0" + end +end + # Optional gem for OpenID authentication group :openid do gem "ruby-openid", "~> 2.1.4", :require => "openid" diff --git a/Gemfile.lock b/Gemfile.lock index e6ee7da7..14f6aa04 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,6 +52,15 @@ GEM rails (>= 3, < 5) arel (3.0.2) builder (3.0.0) + capybara (2.0.3) + mime-types (>= 1.16) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + selenium-webdriver (~> 2.0) + xpath (~> 1.0.0) + childprocess (0.5.3) + ffi (~> 1.0, >= 1.0.11) coderay (1.0.9) coffee-rails (3.2.2) coffee-script (>= 2.2.0) @@ -64,6 +73,7 @@ GEM execjs (1.4.0) multi_json (~> 1.0) fastercsv (1.5.0) + ffi (1.9.3-x86-mingw32) hike (1.2.3) i18n (0.6.1) journey (1.0.4) @@ -74,10 +84,14 @@ GEM mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) + metaclass (0.0.4) mime-types (1.23) + mocha (0.13.3) + metaclass (~> 0.0.1) multi_json (1.7.6) mysql2 (0.3.11-x86-mingw32) net-ldap (0.3.1) + nokogiri (1.5.11-x86-mingw32) polyglot (0.3.3) rack (1.4.5) rack-cache (1.2) @@ -104,15 +118,28 @@ GEM rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) - rake (10.0.4) + rake (10.3.2) rdoc (3.12.2) json (~> 1.4) + rmagick (2.13.2) ruby-openid (2.1.8) + rubyzip (1.1.4) sass (3.2.7) sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) + selenium-webdriver (2.42.0) + childprocess (>= 0.5.0) + multi_json (~> 1.0) + rubyzip (~> 1.0) + websocket (~> 1.0.4) + shoulda (3.5.0) + shoulda-context (~> 1.0, >= 1.0.1) + shoulda-matchers (>= 1.4.1, < 3.0) + shoulda-context (1.2.1) + shoulda-matchers (2.6.1) + activesupport (>= 3.0.0) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) @@ -127,6 +154,9 @@ GEM uglifier (1.0.3) execjs (>= 0.3.0) multi_json (>= 1.0.2) + websocket (1.0.7) + xpath (1.0.0) + nokogiri (~> 1.3) PLATFORMS x86-mingw32 @@ -137,17 +167,22 @@ DEPENDENCIES acts-as-taggable-on (= 2.4.1) better_errors! builder (= 3.0.0) + capybara (~> 2.0.0) coderay (~> 1.0.6) coffee-rails (~> 3.2.1) fastercsv (~> 1.5.0) i18n (~> 0.6.0) jquery-rails (~> 2.0.2) + mocha (~> 0.13.3) mysql2 (~> 0.3.11) net-ldap (~> 0.3.1) + nokogiri (< 1.6.0) rack-mini-profiler! rack-openid rails (= 3.2.13) + rmagick (>= 2.0.0) ruby-openid (~> 2.1.4) sass-rails (~> 3.2.3) seems_rateable! + shoulda (> 3.3.2) uglifier (>= 1.0.3) diff --git a/db/schema.rb b/db/schema.rb index 18cc2a71..63020ad6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -713,7 +713,7 @@ ActiveRecord::Schema.define(:version => 20140618020535) do end create_table "relative_memos", :force => true do |t| - t.integer "osp_id", :null => false + t.integer "osp_id" t.integer "parent_id" t.string "subject", :null => false t.text "content", :null => false @@ -961,13 +961,11 @@ ActiveRecord::Schema.define(:version => 20140618020535) do end create_table "user_scores", :force => true do |t| - t.integer "user_id", :null => false - t.integer "collaboration" - t.integer "influence" - t.integer "skill" - t.integer "active" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "user_id" + t.integer "collaboration" + t.integer "influence" + t.integer "skill" + t.integer "activity" end create_table "user_statuses", :force => true do |t| diff --git a/doc/测试环境搭建.doc b/doc/测试环境搭建.doc index 7aa1372d..106a5db4 100644 Binary files a/doc/测试环境搭建.doc and b/doc/测试环境搭建.doc differ diff --git a/lib/redmine/version.rb b/lib/redmine/version.rb index d7e9c5fa..0ca09f13 100644 --- a/lib/redmine/version.rb +++ b/lib/redmine/version.rb @@ -2,9 +2,9 @@ require 'rexml/document' module Redmine module VERSION #:nodoc: - MAJOR = 1 - MINOR = 0 - TINY = 0 + MAJOR = 2 + MINOR = 3 + TINY = 2 # Branch values: # * official release: nil diff --git a/test/extra/redmine_pm/repository_git_test.rb b/test/extra/redmine_pm/repository_git_test.rb new file mode 100644 index 00000000..8b48cab8 --- /dev/null +++ b/test/extra/redmine_pm/repository_git_test.rb @@ -0,0 +1,97 @@ +# 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_case', __FILE__) +require 'tmpdir' + +class RedminePmTest::RepositoryGitTest < RedminePmTest::TestCase + fixtures :projects, :users, :members, :roles, :member_roles + + GIT_BIN = Redmine::Configuration['scm_git_command'] || "git" + + def test_anonymous_read_on_public_repo_with_permission_should_succeed + assert_success "ls-remote", git_url + end + + def test_anonymous_read_on_public_repo_without_permission_should_fail + Role.anonymous.remove_permission! :browse_repository + assert_failure "ls-remote", git_url + end + + def test_invalid_credentials_should_fail + Project.find(1).update_attribute :is_public, false + with_credentials "dlopper", "foo" do + assert_success "ls-remote", git_url + end + with_credentials "dlopper", "wrong" do + assert_failure "ls-remote", git_url + end + end + + def test_clone + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + assert_success "clone", git_url + end + end + end + + def test_write_commands + Role.find(2).add_permission! :commit_access + filename = random_filename + + Dir.mktmpdir do |dir| + assert_success "clone", git_url, dir + Dir.chdir(dir) do + f = File.new(File.join(dir, filename), "w") + f.write "test file content" + f.close + + with_credentials "dlopper", "foo" do + assert_success "add", filename + assert_success "commit -a --message Committing_a_file" + assert_success "push", git_url, "--all" + end + end + end + + Dir.mktmpdir do |dir| + assert_success "clone", git_url, dir + Dir.chdir(dir) do + assert File.exists?(File.join(dir, "#{filename}")) + end + end + end + + protected + + def execute(*args) + a = [GIT_BIN] + super a, *args + end + + def git_url(path=nil) + host = ENV['REDMINE_TEST_DAV_SERVER'] || '127.0.0.1' + credentials = nil + if username && password + credentials = "#{username}:#{password}" + end + url = "http://#{credentials}@#{host}/git/ecookbook" + url << "/#{path}" if path + url + end +end diff --git a/test/extra/redmine_pm/repository_subversion_test.rb b/test/extra/redmine_pm/repository_subversion_test.rb new file mode 100644 index 00000000..15a37082 --- /dev/null +++ b/test/extra/redmine_pm/repository_subversion_test.rb @@ -0,0 +1,294 @@ +# 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_case', __FILE__) +require 'tmpdir' + +class RedminePmTest::RepositorySubversionTest < RedminePmTest::TestCase + fixtures :projects, :users, :members, :roles, :member_roles, :auth_sources + + SVN_BIN = Redmine::Configuration['scm_subversion_command'] || "svn" + + def test_anonymous_read_on_public_repo_with_permission_should_succeed + assert_success "ls", svn_url + end + + def test_anonymous_read_on_public_repo_without_permission_should_fail + Role.anonymous.remove_permission! :browse_repository + assert_failure "ls", svn_url + end + + def test_anonymous_read_on_private_repo_should_fail + Project.find(1).update_attribute :is_public, false + assert_failure "ls", svn_url + end + + def test_anonymous_commit_on_public_repo_should_fail + Role.anonymous.add_permission! :commit_access + assert_failure "mkdir --message Creating_a_directory", svn_url(random_filename) + end + + def test_anonymous_commit_on_private_repo_should_fail + Role.anonymous.add_permission! :commit_access + Project.find(1).update_attribute :is_public, false + assert_failure "mkdir --message Creating_a_directory", svn_url(random_filename) + end + + def test_non_member_read_on_public_repo_with_permission_should_succeed + Role.anonymous.remove_permission! :browse_repository + with_credentials "miscuser8", "foo" do + assert_success "ls", svn_url + end + end + + def test_non_member_read_on_public_repo_without_permission_should_fail + Role.anonymous.remove_permission! :browse_repository + Role.non_member.remove_permission! :browse_repository + with_credentials "miscuser8", "foo" do + assert_failure "ls", svn_url + end + end + + def test_non_member_read_on_private_repo_should_fail + Project.find(1).update_attribute :is_public, false + with_credentials "miscuser8", "foo" do + assert_failure "ls", svn_url + end + end + + def test_non_member_commit_on_public_repo_should_fail + Role.non_member.add_permission! :commit_access + assert_failure "mkdir --message Creating_a_directory", svn_url(random_filename) + end + + def test_non_member_commit_on_private_repo_should_fail + Role.non_member.add_permission! :commit_access + Project.find(1).update_attribute :is_public, false + assert_failure "mkdir --message Creating_a_directory", svn_url(random_filename) + end + + def test_member_read_on_public_repo_with_permission_should_succeed + Role.anonymous.remove_permission! :browse_repository + Role.non_member.remove_permission! :browse_repository + with_credentials "dlopper", "foo" do + assert_success "ls", svn_url + end + end + + def test_member_read_on_public_repo_without_permission_should_fail + Role.anonymous.remove_permission! :browse_repository + Role.non_member.remove_permission! :browse_repository + Role.find(2).remove_permission! :browse_repository + with_credentials "dlopper", "foo" do + assert_failure "ls", svn_url + end + end + + def test_member_read_on_private_repo_with_permission_should_succeed + Project.find(1).update_attribute :is_public, false + with_credentials "dlopper", "foo" do + assert_success "ls", svn_url + end + end + + def test_member_read_on_private_repo_without_permission_should_fail + Role.find(2).remove_permission! :browse_repository + Project.find(1).update_attribute :is_public, false + with_credentials "dlopper", "foo" do + assert_failure "ls", svn_url + end + end + + def test_member_commit_on_public_repo_with_permission_should_succeed + Role.find(2).add_permission! :commit_access + with_credentials "dlopper", "foo" do + assert_success "mkdir --message Creating_a_directory", svn_url(random_filename) + end + end + + def test_member_commit_on_public_repo_without_permission_should_fail + Role.find(2).remove_permission! :commit_access + with_credentials "dlopper", "foo" do + assert_failure "mkdir --message Creating_a_directory", svn_url(random_filename) + end + end + + def test_member_commit_on_private_repo_with_permission_should_succeed + Role.find(2).add_permission! :commit_access + Project.find(1).update_attribute :is_public, false + with_credentials "dlopper", "foo" do + assert_success "mkdir --message Creating_a_directory", svn_url(random_filename) + end + end + + def test_member_commit_on_private_repo_without_permission_should_fail + Role.find(2).remove_permission! :commit_access + Project.find(1).update_attribute :is_public, false + with_credentials "dlopper", "foo" do + assert_failure "mkdir --message Creating_a_directory", svn_url(random_filename) + end + end + + def test_invalid_credentials_should_fail + Project.find(1).update_attribute :is_public, false + with_credentials "dlopper", "foo" do + assert_success "ls", svn_url + end + with_credentials "dlopper", "wrong" do + assert_failure "ls", svn_url + end + end + + def test_anonymous_read_should_fail_with_login_required + assert_success "ls", svn_url + with_settings :login_required => '1' do + assert_failure "ls", svn_url + end + end + + def test_authenticated_read_should_succeed_with_login_required + with_settings :login_required => '1' do + with_credentials "miscuser8", "foo" do + assert_success "ls", svn_url + end + end + end + + def test_read_on_archived_projects_should_fail + Project.find(1).update_attribute :status, Project::STATUS_ARCHIVED + assert_failure "ls", svn_url + end + + def test_read_on_archived_private_projects_should_fail + Project.find(1).update_attribute :status, Project::STATUS_ARCHIVED + Project.find(1).update_attribute :is_public, false + with_credentials "dlopper", "foo" do + assert_failure "ls", svn_url + end + end + + def test_read_on_closed_projects_should_succeed + Project.find(1).update_attribute :status, Project::STATUS_CLOSED + assert_success "ls", svn_url + end + + def test_read_on_closed_private_projects_should_succeed + Project.find(1).update_attribute :status, Project::STATUS_CLOSED + Project.find(1).update_attribute :is_public, false + with_credentials "dlopper", "foo" do + assert_success "ls", svn_url + end + end + + def test_commit_on_closed_projects_should_fail + Project.find(1).update_attribute :status, Project::STATUS_CLOSED + Role.find(2).add_permission! :commit_access + with_credentials "dlopper", "foo" do + assert_failure "mkdir --message Creating_a_directory", svn_url(random_filename) + end + end + + def test_commit_on_closed_private_projects_should_fail + Project.find(1).update_attribute :status, Project::STATUS_CLOSED + Project.find(1).update_attribute :is_public, false + Role.find(2).add_permission! :commit_access + with_credentials "dlopper", "foo" do + assert_failure "mkdir --message Creating_a_directory", svn_url(random_filename) + end + end + + if ldap_configured? + def test_user_with_ldap_auth_source_should_authenticate_with_ldap_credentials + ldap_user = User.new(:mail => 'example1@redmine.org', :firstname => 'LDAP', :lastname => 'user', :auth_source_id => 1) + ldap_user.login = 'example1' + ldap_user.save! + + with_settings :login_required => '1' do + with_credentials "example1", "123456" do + assert_success "ls", svn_url + end + end + + with_settings :login_required => '1' do + with_credentials "example1", "wrong" do + assert_failure "ls", svn_url + end + end + end + end + + def test_checkout + Dir.mktmpdir do |dir| + assert_success "checkout", svn_url, dir + end + end + + def test_read_commands + assert_success "info", svn_url + assert_success "ls", svn_url + assert_success "log", svn_url + end + + def test_write_commands + Role.find(2).add_permission! :commit_access + filename = random_filename + + Dir.mktmpdir do |dir| + assert_success "checkout", svn_url, dir + Dir.chdir(dir) do + # creates a file in the working copy + f = File.new(File.join(dir, filename), "w") + f.write "test file content" + f.close + + assert_success "add", filename + with_credentials "dlopper", "foo" do + assert_success "commit --message Committing_a_file" + assert_success "copy --message Copying_a_file", svn_url(filename), svn_url("#{filename}_copy") + assert_success "delete --message Deleting_a_file", svn_url(filename) + assert_success "mkdir --message Creating_a_directory", svn_url("#{filename}_dir") + end + assert_success "update" + + # checks that the working copy was updated + assert File.exists?(File.join(dir, "#{filename}_copy")) + assert File.directory?(File.join(dir, "#{filename}_dir")) + end + end + end + + def test_read_invalid_repo_should_fail + assert_failure "ls", svn_url("invalid") + end + + protected + + def execute(*args) + a = [SVN_BIN, "--no-auth-cache --non-interactive"] + a << "--username #{username}" if username + a << "--password #{password}" if password + + super a, *args + end + + def svn_url(path=nil) + host = ENV['REDMINE_TEST_DAV_SERVER'] || '127.0.0.1' + url = "http://#{host}/svn/ecookbook" + url << "/#{path}" if path + url + end +end diff --git a/test/extra/redmine_pm/test_case.rb b/test/extra/redmine_pm/test_case.rb new file mode 100644 index 00000000..594a58a8 --- /dev/null +++ b/test/extra/redmine_pm/test_case.rb @@ -0,0 +1,81 @@ +# 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__) + +module RedminePmTest + class TestCase < ActiveSupport::TestCase + attr_reader :command, :response, :status, :username, :password + + # Cannot use transactional fixtures here: database + # will be accessed from Redmine.pm with its own connection + self.use_transactional_fixtures = false + + def test_dummy + end + + protected + + def assert_response(expected, msg=nil) + case expected + when :success + assert_equal 0, status, + (msg || "The command failed (exit: #{status}):\n #{command}\nOutput was:\n#{formatted_response}") + when :failure + assert_not_equal 0, status, + (msg || "The command succeed (exit: #{status}):\n #{command}\nOutput was:\n#{formatted_response}") + else + assert_equal expected, status, msg + end + end + + def assert_success(*args) + execute *args + assert_response :success + end + + def assert_failure(*args) + execute *args + assert_response :failure + end + + def with_credentials(username, password) + old_username, old_password = @username, @password + @username, @password = username, password + yield if block_given? + ensure + @username, @password = old_username, old_password + end + + def execute(*args) + @command = args.join(' ') + @status = nil + IO.popen("#{command} 2>&1") do |io| + @response = io.read + end + @status = $?.exitstatus + end + + def formatted_response + "#{'='*40}\n#{response}#{'='*40}" + end + + def random_filename + Redmine::Utils.random_hex(16) + end + end +end diff --git a/test/fixtures/attachments.yml b/test/fixtures/attachments.yml index 33bd6015..6384c8ee 100644 --- a/test/fixtures/attachments.yml +++ b/test/fixtures/attachments.yml @@ -267,31 +267,3 @@ attachments_020: filename: root_attachment.txt filesize: 54 author_id: 2 -attachments_021: - content_type: text/plain - downloads: 0 - created_on: 2012-05-12 16:14:50 +09:00 - disk_filename: 120512161450_project_test.txt - disk_directory: - container_id: 2 - digest: b0fe2abdb2599743d554a61d7da7ff74 - id: 21 - container_type: Project - description: "" - filename: project_test.txt - filesize: 54 - author_id: 2 -attachments_022: - content_type: text/plain - downloads: 0 - created_on: 2012-05-12 16:14:50 +09:00 - disk_filename: 120512161450_course_test.txt - disk_directory: - container_id: 1 - digest: b0fe2abdb2599743d554a61d7da7ff74 - id: 22 - container_type: Project - description: "" - filename: course_test.txt - filesize: 54 - author_id: 2 \ No newline at end of file diff --git a/test/fixtures/auth_sources.yml b/test/fixtures/auth_sources.yml new file mode 100644 index 00000000..a58a2888 --- /dev/null +++ b/test/fixtures/auth_sources.yml @@ -0,0 +1,13 @@ +--- +auth_sources_001: + id: 1 + type: AuthSourceLdap + name: 'LDAP test server' + host: '127.0.0.1' + port: 389 + base_dn: 'OU=Person,DC=redmine,DC=org' + attr_login: uid + attr_firstname: givenName + attr_lastname: sn + attr_mail: mail + onthefly_register: false diff --git a/test/fixtures/changes.yml b/test/fixtures/changes.yml new file mode 100644 index 00000000..487aad77 --- /dev/null +++ b/test/fixtures/changes.yml @@ -0,0 +1,22 @@ +--- +changes_001: + id: 1 + changeset_id: 100 + action: A + path: /test/some/path/in/the/repo + from_path: + from_revision: +changes_002: + id: 2 + changeset_id: 100 + action: A + path: /test/some/path/elsewhere/in/the/repo + from_path: + from_revision: +changes_003: + id: 3 + changeset_id: 101 + action: M + path: /test/some/path/in/the/repo + from_path: + from_revision: diff --git a/test/fixtures/changesets.yml b/test/fixtures/changesets.yml new file mode 100644 index 00000000..49bd18cc --- /dev/null +++ b/test/fixtures/changesets.yml @@ -0,0 +1,104 @@ +--- +changesets_001: + commit_date: 2007-04-11 + committed_on: 2007-04-11 15:14:44 +02:00 + revision: 1 + scmid: 691322a8eb01e11fd7 + id: 100 + comments: 'My very first commit do not escaping #<>&' + repository_id: 10 + committer: dlopper + user_id: 3 +changesets_002: + commit_date: 2007-04-12 + committed_on: 2007-04-12 15:14:44 +02:00 + revision: 2 + id: 101 + comments: 'This commit fixes #1, #2 and references #1 & #3' + repository_id: 10 + committer: dlopper + user_id: 3 +changesets_003: + commit_date: 2007-04-12 + committed_on: 2007-04-12 15:14:44 +02:00 + revision: 3 + id: 102 + comments: |- + A commit with wrong issue ids + IssueID #666 #3 + repository_id: 10 + committer: dlopper + user_id: 3 +changesets_004: + commit_date: 2007-04-12 + committed_on: 2007-04-12 15:14:44 +02:00 + revision: 4 + id: 103 + comments: |- + A commit with an issue id of an other project + IssueID 4 2 + repository_id: 10 + committer: dlopper + user_id: 3 +changesets_005: + commit_date: "2007-09-10" + comments: Modified one file in the folder. + committed_on: 2007-09-10 19:01:08 + revision: "5" + id: 104 + scmid: + user_id: 3 + repository_id: 10 + committer: dlopper +changesets_006: + commit_date: "2007-09-10" + comments: Moved helloworld.rb from / to /folder. + committed_on: 2007-09-10 19:01:47 + revision: "6" + id: 105 + scmid: + user_id: 3 + repository_id: 10 + committer: dlopper +changesets_007: + commit_date: "2007-09-10" + comments: Removed one file. + committed_on: 2007-09-10 19:02:16 + revision: "7" + id: 106 + scmid: + user_id: 3 + repository_id: 10 + committer: dlopper +changesets_008: + commit_date: "2007-09-10" + comments: |- + This commits references an issue. + Refs #2 + committed_on: 2007-09-10 19:04:35 + revision: "8" + id: 107 + scmid: + user_id: 3 + repository_id: 10 + committer: dlopper +changesets_009: + commit_date: "2009-09-10" + comments: One file added. + committed_on: 2009-09-10 19:04:35 + revision: "9" + id: 108 + scmid: + user_id: 3 + repository_id: 10 + committer: dlopper +changesets_010: + commit_date: "2009-09-10" + comments: Same file modified. + committed_on: 2009-09-10 19:04:35 + revision: "10" + id: 109 + scmid: + user_id: 3 + repository_id: 10 + committer: dlopper diff --git a/test/fixtures/comments.yml b/test/fixtures/comments.yml new file mode 100644 index 00000000..b69b28c7 --- /dev/null +++ b/test/fixtures/comments.yml @@ -0,0 +1,17 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html +comments_001: + commented_type: News + commented_id: 1 + id: 1 + author_id: 1 + comments: my first comment + created_on: 2006-12-10 18:10:10 +01:00 + updated_on: 2006-12-10 18:10:10 +01:00 +comments_002: + commented_type: News + commented_id: 1 + id: 2 + author_id: 2 + comments: This is an other comment + created_on: 2006-12-10 18:12:10 +01:00 + updated_on: 2006-12-10 18:12:10 +01:00 diff --git a/test/fixtures/configuration/default.yml b/test/fixtures/configuration/default.yml new file mode 100644 index 00000000..fcca8268 --- /dev/null +++ b/test/fixtures/configuration/default.yml @@ -0,0 +1,8 @@ +default: + somesetting: foo + +production: + +development: + +test: diff --git a/test/fixtures/configuration/empty.yml b/test/fixtures/configuration/empty.yml new file mode 100644 index 00000000..24b33942 --- /dev/null +++ b/test/fixtures/configuration/empty.yml @@ -0,0 +1,7 @@ +default: + +production: + +development: + +test: diff --git a/test/fixtures/configuration/no_default.yml b/test/fixtures/configuration/no_default.yml new file mode 100644 index 00000000..b5895a29 --- /dev/null +++ b/test/fixtures/configuration/no_default.yml @@ -0,0 +1,8 @@ +default: + +production: + +development: + +test: + somesetting: foo diff --git a/test/fixtures/configuration/overrides.yml b/test/fixtures/configuration/overrides.yml new file mode 100644 index 00000000..cab915a3 --- /dev/null +++ b/test/fixtures/configuration/overrides.yml @@ -0,0 +1,9 @@ +default: + somesetting: foo + +production: + +development: + +test: + somesetting: bar diff --git a/test/fixtures/custom_fields.yml b/test/fixtures/custom_fields.yml new file mode 100644 index 00000000..7cbd5613 --- /dev/null +++ b/test/fixtures/custom_fields.yml @@ -0,0 +1,165 @@ +--- +custom_fields_001: + name: Database + min_length: 0 + regexp: "" + is_for_all: true + is_filter: true + type: IssueCustomField + max_length: 0 + possible_values: + - MySQL + - PostgreSQL + - Oracle + id: 1 + is_required: false + field_format: list + default_value: "" + editable: true + position: 2 +custom_fields_002: + name: Searchable field + min_length: 1 + regexp: "" + is_for_all: true + is_filter: true + type: IssueCustomField + max_length: 100 + possible_values: "" + id: 2 + is_required: false + field_format: string + searchable: true + default_value: "Default string" + editable: true + position: 1 +custom_fields_003: + name: Development status + min_length: 0 + regexp: "" + is_for_all: false + is_filter: true + type: ProjectCustomField + max_length: 0 + possible_values: + - Stable + - Beta + - Alpha + - Planning + id: 3 + is_required: false + field_format: list + default_value: "" + editable: true + position: 1 +custom_fields_004: + name: Phone number + min_length: 0 + regexp: "" + is_for_all: false + type: UserCustomField + max_length: 0 + possible_values: "" + id: 4 + is_required: false + field_format: string + default_value: "" + editable: true + position: 1 +custom_fields_005: + name: Money + min_length: 0 + regexp: "" + is_for_all: false + type: UserCustomField + max_length: 0 + possible_values: "" + id: 5 + is_required: false + field_format: float + default_value: "" + editable: true + position: 2 +custom_fields_006: + name: Float field + min_length: 0 + regexp: "" + is_for_all: true + type: IssueCustomField + max_length: 0 + possible_values: "" + id: 6 + is_required: false + field_format: float + default_value: "" + editable: true + position: 3 +custom_fields_007: + name: Billable + min_length: 0 + regexp: "" + is_for_all: false + is_filter: true + type: TimeEntryActivityCustomField + max_length: 0 + possible_values: "" + id: 7 + is_required: false + field_format: bool + default_value: "" + editable: true + position: 1 +custom_fields_008: + name: Custom date + min_length: 0 + regexp: "" + is_for_all: true + is_filter: false + type: IssueCustomField + max_length: 0 + possible_values: "" + id: 8 + is_required: false + field_format: date + default_value: "" + editable: true + position: 4 +custom_fields_009: + name: Project 1 cf + min_length: 0 + regexp: "" + is_for_all: false + is_filter: true + type: IssueCustomField + max_length: 0 + possible_values: "" + id: 9 + is_required: false + field_format: date + default_value: "" + editable: true + position: 5 +custom_fields_010: + name: Overtime + min_length: 0 + regexp: "" + is_for_all: false + is_filter: false + type: TimeEntryCustomField + max_length: 0 + possible_values: "" + id: 10 + is_required: false + field_format: bool + default_value: 0 + editable: true + position: 1 +custom_fields_011: + id: 11 + name: Binary + type: CustomField + possible_values: + - !binary | + SGXDqWzDp2prc2Tigqw2NTTDuQ== + - Other value + field_format: list diff --git a/test/fixtures/custom_fields_projects.yml b/test/fixtures/custom_fields_projects.yml new file mode 100644 index 00000000..295919b0 --- /dev/null +++ b/test/fixtures/custom_fields_projects.yml @@ -0,0 +1,4 @@ +--- +custom_fields_projects_001: + custom_field_id: 9 + project_id: 1 diff --git a/test/fixtures/custom_fields_trackers.yml b/test/fixtures/custom_fields_trackers.yml new file mode 100644 index 00000000..bfbe0d24 --- /dev/null +++ b/test/fixtures/custom_fields_trackers.yml @@ -0,0 +1,19 @@ +--- +custom_fields_trackers_001: + custom_field_id: 1 + tracker_id: 1 +custom_fields_trackers_002: + custom_field_id: 2 + tracker_id: 1 +custom_fields_trackers_003: + custom_field_id: 2 + tracker_id: 3 +custom_fields_trackers_004: + custom_field_id: 6 + tracker_id: 1 +custom_fields_trackers_005: + custom_field_id: 6 + tracker_id: 2 +custom_fields_trackers_006: + custom_field_id: 6 + tracker_id: 3 diff --git a/test/fixtures/custom_values.yml b/test/fixtures/custom_values.yml new file mode 100644 index 00000000..efc8a292 --- /dev/null +++ b/test/fixtures/custom_values.yml @@ -0,0 +1,103 @@ +--- +custom_values_006: + customized_type: Issue + custom_field_id: 2 + customized_id: 3 + id: 6 + value: "125" +custom_values_007: + customized_type: Project + custom_field_id: 3 + customized_id: 1 + id: 7 + value: Stable +custom_values_001: + customized_type: Principal + custom_field_id: 4 + customized_id: 3 + id: 1 + value: "" +custom_values_002: + customized_type: Principal + custom_field_id: 4 + customized_id: 4 + id: 2 + value: 01 23 45 67 89 +custom_values_003: + customized_type: Principal + custom_field_id: 4 + customized_id: 2 + id: 3 + value: "01 42 50 00 00" +custom_values_004: + customized_type: Issue + custom_field_id: 2 + customized_id: 1 + id: 4 + value: "125" +custom_values_005: + customized_type: Issue + custom_field_id: 2 + customized_id: 2 + id: 5 + value: "" +custom_values_008: + customized_type: Issue + custom_field_id: 1 + customized_id: 3 + id: 8 + value: "MySQL" +custom_values_009: + customized_type: Issue + custom_field_id: 2 + customized_id: 7 + id: 9 + value: "this is a stringforcustomfield search" +custom_values_010: + customized_type: Issue + custom_field_id: 6 + customized_id: 1 + id: 10 + value: "2.1" +custom_values_011: + customized_type: Issue + custom_field_id: 6 + customized_id: 2 + id: 11 + value: "2.05" +custom_values_012: + customized_type: Issue + custom_field_id: 6 + customized_id: 3 + id: 12 + value: "11.65" +custom_values_013: + customized_type: Issue + custom_field_id: 6 + customized_id: 7 + id: 13 + value: "" +custom_values_014: + customized_type: Issue + custom_field_id: 6 + customized_id: 5 + id: 14 + value: "-7.6" +custom_values_015: + customized_type: Enumeration + custom_field_id: 7 + customized_id: 10 + id: 15 + value: true +custom_values_016: + customized_type: Enumeration + custom_field_id: 7 + customized_id: 11 + id: 16 + value: '1' +custom_values_017: + customized_type: Issue + custom_field_id: 8 + customized_id: 1 + id: 17 + value: '2009-12-01' diff --git a/test/fixtures/diffs/issue-12641-ja.diff b/test/fixtures/diffs/issue-12641-ja.diff new file mode 100644 index 00000000..f19df33f --- /dev/null +++ b/test/fixtures/diffs/issue-12641-ja.diff @@ -0,0 +1,25 @@ +# HG changeset patch +# User tmaruyama +# Date 1362559296 0 +# Node ID ee54942e0289c30bea1b1973750b698b1ee7c466 +# Parent 738777832f379f6f099c25251593fc57bc17f586 +fix some Japanese "issue" translations (#13350) + +Contributed by Go MAEDA. + +diff --git a/config/locales/ja.yml b/config/locales/ja.yml +--- a/config/locales/ja.yml ++++ b/config/locales/ja.yml +@@ -904,9 +904,9 @@ ja: + text_journal_set_to: "%{label} を %{value} にセット" + text_journal_deleted: "%{label} を削除 (%{old})" + text_journal_added: "%{label} %{value} を追加" +- text_tip_issue_begin_day: この日に開始するタスク +- text_tip_issue_end_day: この日に終了するタスク +- text_tip_issue_begin_end_day: この日のうちに開始して終了するタスク ++ text_tip_issue_begin_day: この日に開始するチケット ++ text_tip_issue_end_day: この日に終了するチケット ++ text_tip_issue_begin_end_day: この日に開始・終了するチケット + text_caracters_maximum: "最大%{count}文字です。" + text_caracters_minimum: "最低%{count}文字の長さが必要です" + text_length_between: "長さは%{min}から%{max}文字までです。" diff --git a/test/fixtures/diffs/issue-12641-ru.diff b/test/fixtures/diffs/issue-12641-ru.diff new file mode 100644 index 00000000..acb8d542 --- /dev/null +++ b/test/fixtures/diffs/issue-12641-ru.diff @@ -0,0 +1,19 @@ +# HG changeset patch +# User tmaruyama +# Date 1355872765 0 +# Node ID 8a13ebed1779c2e85fa644ecdd0de81996c969c4 +# Parent 5c3c5f917ae92f278fe42c6978366996595b0796 +Russian "about_x_hours" translation changed by Mikhail Velkin (#12640) + +diff --git a/config/locales/ru.yml b/config/locales/ru.yml +--- a/config/locales/ru.yml ++++ b/config/locales/ru.yml +@@ -115,7 +115,7 @@ ru: + one: "около %{count} часа" + few: "около %{count} часов" + many: "около %{count} часов" +- other: "около %{count} часа" ++ other: "около %{count} часов" + x_hours: + one: "1 час" + other: "%{count} часов" diff --git a/test/fixtures/diffs/issue-13644-1.diff b/test/fixtures/diffs/issue-13644-1.diff new file mode 100644 index 00000000..95c48ef4 --- /dev/null +++ b/test/fixtures/diffs/issue-13644-1.diff @@ -0,0 +1,7 @@ +--- a.txt 2013-04-05 14:19:39.000000000 +0900 ++++ b.txt 2013-04-05 14:19:51.000000000 +0900 +@@ -1,3 +1,3 @@ + aaaa +-日本 ++日本語 + bbbb diff --git a/test/fixtures/diffs/issue-13644-2.diff b/test/fixtures/diffs/issue-13644-2.diff new file mode 100644 index 00000000..f8a4076e --- /dev/null +++ b/test/fixtures/diffs/issue-13644-2.diff @@ -0,0 +1,7 @@ +--- a.txt 2013-04-05 14:19:39.000000000 +0900 ++++ b.txt 2013-04-05 14:19:51.000000000 +0900 +@@ -1,3 +1,3 @@ + aaaa +-日本 ++にっぽん日本 + bbbb diff --git a/test/fixtures/diffs/partials.diff b/test/fixtures/diffs/partials.diff new file mode 100644 index 00000000..f6879bc8 --- /dev/null +++ b/test/fixtures/diffs/partials.diff @@ -0,0 +1,46 @@ +--- partials.txt Wed Jan 19 12:06:17 2011 ++++ partials.1.txt Wed Jan 19 12:06:10 2011 +@@ -1,31 +1,31 @@ +-Lorem ipsum dolor sit amet, consectetur adipiscing elit ++Lorem ipsum dolor sit amet, consectetur adipiscing xx + Praesent et sagittis dui. Vivamus ac diam diam +-Ut sed auctor justo ++xxx auctor justo + Suspendisse venenatis sollicitudin magna quis suscipit +-Sed blandit gravida odio ac ultrices ++Sed blandit gxxxxa odio ac ultrices + Morbi rhoncus est ut est aliquam tempus +-Morbi id nisi vel felis tincidunt tempus ++Morbi id nisi vel felis xx tempus + Mauris auctor sagittis ante eu luctus +-Fusce commodo felis sed ligula congue molestie ++Fusce commodo felis sed ligula congue + Lorem ipsum dolor sit amet, consectetur adipiscing elit +-Praesent et sagittis dui. Vivamus ac diam diam ++et sagittis dui. Vivamus ac diam diam + Ut sed auctor justo + Suspendisse venenatis sollicitudin magna quis suscipit + Sed blandit gravida odio ac ultrices + +-Lorem ipsum dolor sit amet, consectetur adipiscing elit +-Praesent et sagittis dui. Vivamus ac diam diam ++Lorem ipsum dolor sit amet, xxxx adipiscing elit + Ut sed auctor justo + Suspendisse venenatis sollicitudin magna quis suscipit + Sed blandit gravida odio ac ultrices +-Morbi rhoncus est ut est aliquam tempus ++Morbi rhoncus est ut est xxxx tempus ++New line + Morbi id nisi vel felis tincidunt tempus + Mauris auctor sagittis ante eu luctus + Fusce commodo felis sed ligula congue molestie + +-Lorem ipsum dolor sit amet, consectetur adipiscing elit +-Praesent et sagittis dui. Vivamus ac diam diam +-Ut sed auctor justo ++Lorem ipsum dolor sit amet, xxxxtetur adipiscing elit ++Praesent et xxxxx. Vivamus ac diam diam ++Ut sed auctor + Suspendisse venenatis sollicitudin magna quis suscipit + Sed blandit gravida odio ac ultrices + Morbi rhoncus est ut est aliquam tempus diff --git a/test/fixtures/diffs/subversion.diff b/test/fixtures/diffs/subversion.diff new file mode 100644 index 00000000..2b1ae520 --- /dev/null +++ b/test/fixtures/diffs/subversion.diff @@ -0,0 +1,79 @@ +Index: app/views/settings/_general.rhtml +=================================================================== +--- app/views/settings/_general.rhtml (revision 2094) ++++ app/views/settings/_general.rhtml (working copy) +@@ -48,6 +48,9 @@ +
+ <%= text_field_tag 'settings[feeds_limit]', Setting.feeds_limit, :size => 6 %>
+ ++++<%= text_field_tag 'settings[diff_max_lines_displayed]', Setting.diff_max_lines_displayed, :size => 6 %>
++ ++ <%= check_box_tag 'settings[gravatar_enabled]', 1, Setting.gravatar_enabled? %><%= hidden_field_tag 'settings[gravatar_enabled]', 0 %>
+ +Index: app/views/common/_diff.rhtml +=================================================================== +--- app/views/common/_diff.rhtml (revision 2111) ++++ app/views/common/_diff.rhtml (working copy) +@@ -1,4 +1,5 @@ +-<% Redmine::UnifiedDiff.new(diff, :type => diff_type).each do |table_file| -%> ++<% diff = Redmine::UnifiedDiff.new(diff, :type => diff_type, :max_lines => Setting.diff_max_lines_displayed.to_i) -%> ++<% diff.each do |table_file| -%> +