annotate .svn/pristine/06/068885f0c95ca2ed440e38b13dd95f7bb13f11dc.svn-base @ 1082:997f6d7738f7 bug_531

In repo controller entry action, show the page for the file even if it's binary (so user still has access to history etc links). This makes it possible to use the entry action as the default when a file is clicked on
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 22 Nov 2012 18:04:17 +0000
parents cbb26bc654de
children
rev   line source
Chris@909 1 # Redmine - project management software
Chris@909 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
Chris@909 3 #
Chris@909 4 # This program is free software; you can redistribute it and/or
Chris@909 5 # modify it under the terms of the GNU General Public License
Chris@909 6 # as published by the Free Software Foundation; either version 2
Chris@909 7 # of the License, or (at your option) any later version.
Chris@909 8 #
Chris@909 9 # This program is distributed in the hope that it will be useful,
Chris@909 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@909 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@909 12 # GNU General Public License for more details.
Chris@909 13 #
Chris@909 14 # You should have received a copy of the GNU General Public License
Chris@909 15 # along with this program; if not, write to the Free Software
Chris@909 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@909 17
Chris@909 18 require File.expand_path('../../test_helper', __FILE__)
Chris@909 19
Chris@909 20 class CustomFieldTest < ActiveSupport::TestCase
Chris@909 21 fixtures :custom_fields
Chris@909 22
Chris@909 23 def test_create
Chris@909 24 field = UserCustomField.new(:name => 'Money money money', :field_format => 'float')
Chris@909 25 assert field.save
Chris@909 26 end
Chris@909 27
Chris@909 28 def test_regexp_validation
Chris@909 29 field = IssueCustomField.new(:name => 'regexp', :field_format => 'text', :regexp => '[a-z0-9')
Chris@909 30 assert !field.save
Chris@909 31 assert_equal I18n.t('activerecord.errors.messages.invalid'), field.errors.on(:regexp)
Chris@909 32
Chris@909 33 field.regexp = '[a-z0-9]'
Chris@909 34 assert field.save
Chris@909 35 end
Chris@909 36
Chris@909 37 def test_possible_values_should_accept_an_array
Chris@909 38 field = CustomField.new
Chris@909 39 field.possible_values = ["One value", ""]
Chris@909 40 assert_equal ["One value"], field.possible_values
Chris@909 41 end
Chris@909 42
Chris@909 43 def test_possible_values_should_accept_a_string
Chris@909 44 field = CustomField.new
Chris@909 45 field.possible_values = "One value"
Chris@909 46 assert_equal ["One value"], field.possible_values
Chris@909 47 end
Chris@909 48
Chris@909 49 def test_possible_values_should_accept_a_multiline_string
Chris@909 50 field = CustomField.new
Chris@909 51 field.possible_values = "One value\nAnd another one \r\n \n"
Chris@909 52 assert_equal ["One value", "And another one"], field.possible_values
Chris@909 53 end
Chris@909 54
Chris@909 55 def test_destroy
Chris@909 56 field = CustomField.find(1)
Chris@909 57 assert field.destroy
Chris@909 58 end
Chris@909 59 end