Revision 1297:0a574315af3e .svn/pristine/8d
| .svn/pristine/8d/8d03cc496803f09b2d6947d04fa8cd315da58e77.svn-base | ||
|---|---|---|
| 1 |
class AddRepositoriesIsDefault < ActiveRecord::Migration |
|
| 2 |
def self.up |
|
| 3 |
add_column :repositories, :is_default, :boolean, :default => false |
|
| 4 |
end |
|
| 5 |
|
|
| 6 |
def self.down |
|
| 7 |
remove_column :repositories, :is_default |
|
| 8 |
end |
|
| 9 |
end |
|
| .svn/pristine/8d/8d4826567079dfbc81f038636c4eb6eabda97212.svn-base | ||
|---|---|---|
| 1 |
# Redmine - project management software |
|
| 2 |
# Copyright (C) 2006-2012 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 'blankslate' |
|
| 19 |
|
|
| 20 |
module Redmine |
|
| 21 |
module Views |
|
| 22 |
module Builders |
|
| 23 |
class Structure < BlankSlate |
|
| 24 |
attr_accessor :request, :response |
|
| 25 |
|
|
| 26 |
def initialize(request, response) |
|
| 27 |
@struct = [{}]
|
|
| 28 |
self.request = request |
|
| 29 |
self.response = response |
|
| 30 |
end |
|
| 31 |
|
|
| 32 |
def array(tag, options={}, &block)
|
|
| 33 |
@struct << [] |
|
| 34 |
block.call(self) |
|
| 35 |
ret = @struct.pop |
|
| 36 |
@struct.last[tag] = ret |
|
| 37 |
@struct.last.merge!(options) if options |
|
| 38 |
end |
|
| 39 |
|
|
| 40 |
def method_missing(sym, *args, &block) |
|
| 41 |
if args.any? |
|
| 42 |
if args.first.is_a?(Hash) |
|
| 43 |
if @struct.last.is_a?(Array) |
|
| 44 |
@struct.last << args.first unless block |
|
| 45 |
else |
|
| 46 |
@struct.last[sym] = args.first |
|
| 47 |
end |
|
| 48 |
else |
|
| 49 |
if @struct.last.is_a?(Array) |
|
| 50 |
if args.size == 1 && !block_given? |
|
| 51 |
@struct.last << args.first |
|
| 52 |
else |
|
| 53 |
@struct.last << (args.last || {}).merge(:value => args.first)
|
|
| 54 |
end |
|
| 55 |
else |
|
| 56 |
@struct.last[sym] = args.first |
|
| 57 |
end |
|
| 58 |
end |
|
| 59 |
end |
|
| 60 |
|
|
| 61 |
if block |
|
| 62 |
@struct << (args.first.is_a?(Hash) ? args.first : {})
|
|
| 63 |
block.call(self) |
|
| 64 |
ret = @struct.pop |
|
| 65 |
if @struct.last.is_a?(Array) |
|
| 66 |
@struct.last << ret |
|
| 67 |
else |
|
| 68 |
if @struct.last.has_key?(sym) && @struct.last[sym].is_a?(Hash) |
|
| 69 |
@struct.last[sym].merge! ret |
|
| 70 |
else |
|
| 71 |
@struct.last[sym] = ret |
|
| 72 |
end |
|
| 73 |
end |
|
| 74 |
end |
|
| 75 |
end |
|
| 76 |
|
|
| 77 |
def output |
|
| 78 |
raise "Need to implement #{self.class.name}#output"
|
|
| 79 |
end |
|
| 80 |
end |
|
| 81 |
end |
|
| 82 |
end |
|
| 83 |
end |
|
| .svn/pristine/8d/8d774416d4f9f9cfc87a53af486a7209216cfa47.svn-base | ||
|---|---|---|
| 1 |
# encoding: utf-8 |
|
| 2 |
# |
|
| 3 |
# Redmine - project management software |
|
| 4 |
# Copyright (C) 2006-2012 Jean-Philippe Lang |
|
| 5 |
# |
|
| 6 |
# This program is free software; you can redistribute it and/or |
|
| 7 |
# modify it under the terms of the GNU General Public License |
|
| 8 |
# as published by the Free Software Foundation; either version 2 |
|
| 9 |
# of the License, or (at your option) any later version. |
|
| 10 |
# |
|
| 11 |
# This program is distributed in the hope that it will be useful, |
|
| 12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 14 |
# GNU General Public License for more details. |
|
| 15 |
# |
|
| 16 |
# You should have received a copy of the GNU General Public License |
|
| 17 |
# along with this program; if not, write to the Free Software |
|
| 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
| 19 |
|
|
| 20 |
module QueriesHelper |
|
| 21 |
def filters_options_for_select(query) |
|
| 22 |
options_for_select(filters_options(query)) |
|
| 23 |
end |
|
| 24 |
|
|
| 25 |
def filters_options(query) |
|
| 26 |
options = [[]] |
|
| 27 |
sorted_options = query.available_filters.sort do |a, b| |
|
| 28 |
ord = 0 |
|
| 29 |
if !(a[1][:order] == 20 && b[1][:order] == 20) |
|
| 30 |
ord = a[1][:order] <=> b[1][:order] |
|
| 31 |
else |
|
| 32 |
cn = (CustomField::CUSTOM_FIELDS_NAMES.index(a[1][:field].class.name) <=> |
|
| 33 |
CustomField::CUSTOM_FIELDS_NAMES.index(b[1][:field].class.name)) |
|
| 34 |
if cn != 0 |
|
| 35 |
ord = cn |
|
| 36 |
else |
|
| 37 |
f = (a[1][:field] <=> b[1][:field]) |
|
| 38 |
if f != 0 |
|
| 39 |
ord = f |
|
| 40 |
else |
|
| 41 |
# assigned_to or author |
|
| 42 |
ord = (a[0] <=> b[0]) |
|
| 43 |
end |
|
| 44 |
end |
|
| 45 |
end |
|
| 46 |
ord |
|
| 47 |
end |
|
| 48 |
options += sorted_options.map do |field, field_options| |
|
| 49 |
[field_options[:name], field] |
|
| 50 |
end |
|
| 51 |
end |
|
| 52 |
|
|
| 53 |
def available_block_columns_tags(query) |
|
| 54 |
tags = ''.html_safe |
|
| 55 |
query.available_block_columns.each do |column| |
|
| 56 |
tags << content_tag('label', check_box_tag('c[]', column.name.to_s, query.has_column?(column)) + " #{column.caption}", :class => 'inline')
|
|
| 57 |
end |
|
| 58 |
tags |
|
| 59 |
end |
|
| 60 |
|
|
| 61 |
def column_header(column) |
|
| 62 |
column.sortable ? sort_header_tag(column.name.to_s, :caption => column.caption, |
|
| 63 |
:default_order => column.default_order) : |
|
| 64 |
content_tag('th', h(column.caption))
|
|
| 65 |
end |
|
| 66 |
|
|
| 67 |
def column_content(column, issue) |
|
| 68 |
value = column.value(issue) |
|
| 69 |
if value.is_a?(Array) |
|
| 70 |
value.collect {|v| column_value(column, issue, v)}.compact.join(', ').html_safe
|
|
| 71 |
else |
|
| 72 |
column_value(column, issue, value) |
|
| 73 |
end |
|
| 74 |
end |
|
| 75 |
|
|
| 76 |
def column_value(column, issue, value) |
|
| 77 |
case value.class.name |
|
| 78 |
when 'String' |
|
| 79 |
if column.name == :subject |
|
| 80 |
link_to(h(value), :controller => 'issues', :action => 'show', :id => issue) |
|
| 81 |
elsif column.name == :description |
|
| 82 |
issue.description? ? content_tag('div', textilizable(issue, :description), :class => "wiki") : ''
|
|
| 83 |
else |
|
| 84 |
h(value) |
|
| 85 |
end |
|
| 86 |
when 'Time' |
|
| 87 |
format_time(value) |
|
| 88 |
when 'Date' |
|
| 89 |
format_date(value) |
|
| 90 |
when 'Fixnum' |
|
| 91 |
if column.name == :done_ratio |
|
| 92 |
progress_bar(value, :width => '80px') |
|
| 93 |
else |
|
| 94 |
value.to_s |
|
| 95 |
end |
|
| 96 |
when 'Float' |
|
| 97 |
sprintf "%.2f", value |
|
| 98 |
when 'User' |
|
| 99 |
link_to_user value |
|
| 100 |
when 'Project' |
|
| 101 |
link_to_project value |
|
| 102 |
when 'Version' |
|
| 103 |
link_to(h(value), :controller => 'versions', :action => 'show', :id => value) |
|
| 104 |
when 'TrueClass' |
|
| 105 |
l(:general_text_Yes) |
|
| 106 |
when 'FalseClass' |
|
| 107 |
l(:general_text_No) |
|
| 108 |
when 'Issue' |
|
| 109 |
link_to_issue(value, :subject => false) |
|
| 110 |
when 'IssueRelation' |
|
| 111 |
other = value.other_issue(issue) |
|
| 112 |
content_tag('span',
|
|
| 113 |
(l(value.label_for(issue)) + " " + link_to_issue(other, :subject => false, :tracker => false)).html_safe, |
|
| 114 |
:class => value.css_classes_for(issue)) |
|
| 115 |
else |
|
| 116 |
h(value) |
|
| 117 |
end |
|
| 118 |
end |
|
| 119 |
|
|
| 120 |
# Retrieve query from session or build a new query |
|
| 121 |
def retrieve_query |
|
| 122 |
if !params[:query_id].blank? |
|
| 123 |
cond = "project_id IS NULL" |
|
| 124 |
cond << " OR project_id = #{@project.id}" if @project
|
|
| 125 |
@query = Query.find(params[:query_id], :conditions => cond) |
|
| 126 |
raise ::Unauthorized unless @query.visible? |
|
| 127 |
@query.project = @project |
|
| 128 |
session[:query] = {:id => @query.id, :project_id => @query.project_id}
|
|
| 129 |
sort_clear |
|
| 130 |
elsif api_request? || params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil) |
|
| 131 |
# Give it a name, required to be valid |
|
| 132 |
@query = Query.new(:name => "_") |
|
| 133 |
@query.project = @project |
|
| 134 |
build_query_from_params |
|
| 135 |
session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names}
|
|
| 136 |
else |
|
| 137 |
# retrieve from session |
|
| 138 |
@query = Query.find_by_id(session[:query][:id]) if session[:query][:id] |
|
| 139 |
@query ||= Query.new(:name => "_", :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names]) |
|
| 140 |
@query.project = @project |
|
| 141 |
end |
|
| 142 |
end |
|
| 143 |
|
|
| 144 |
def retrieve_query_from_session |
|
| 145 |
if session[:query] |
|
| 146 |
if session[:query][:id] |
|
| 147 |
@query = Query.find_by_id(session[:query][:id]) |
|
| 148 |
return unless @query |
|
| 149 |
else |
|
| 150 |
@query = Query.new(:name => "_", :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names]) |
|
| 151 |
end |
|
| 152 |
if session[:query].has_key?(:project_id) |
|
| 153 |
@query.project_id = session[:query][:project_id] |
|
| 154 |
else |
|
| 155 |
@query.project = @project |
|
| 156 |
end |
|
| 157 |
@query |
|
| 158 |
end |
|
| 159 |
end |
|
| 160 |
|
|
| 161 |
def build_query_from_params |
|
| 162 |
if params[:fields] || params[:f] |
|
| 163 |
@query.filters = {}
|
|
| 164 |
@query.add_filters(params[:fields] || params[:f], params[:operators] || params[:op], params[:values] || params[:v]) |
|
| 165 |
else |
|
| 166 |
@query.available_filters.keys.each do |field| |
|
| 167 |
@query.add_short_filter(field, params[field]) if params[field] |
|
| 168 |
end |
|
| 169 |
end |
|
| 170 |
@query.group_by = params[:group_by] || (params[:query] && params[:query][:group_by]) |
|
| 171 |
@query.column_names = params[:c] || (params[:query] && params[:query][:column_names]) |
|
| 172 |
end |
|
| 173 |
end |
|
| .svn/pristine/8d/8d7f3b26aa44788861a89ec2075a19d495cdeed9.svn-base | ||
|---|---|---|
| 1 |
begin |
|
| 2 |
require('htmlentities')
|
|
| 3 |
rescue LoadError |
|
| 4 |
# This gem is not required - just nice to have. |
|
| 5 |
end |
|
| 6 |
require('cgi')
|
|
| 7 |
require 'rfpdf' |
|
| 8 |
|
|
| 9 |
# Mime::Type.register "application/pdf", :pdf |
|
| 10 |
# ActionView::Template::register_template_handler 'rfpdf', RFPDF::TemplateHandlers::Base |
|
| 11 |
|
|
| .svn/pristine/8d/8dc9ba58d5c32e2b12008831132dee86e138a33d.svn-base | ||
|---|---|---|
| 1 |
# Redmine - project management software |
|
| 2 |
# Copyright (C) 2006-2012 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 RoutingActivitiesTest < ActionController::IntegrationTest |
|
| 21 |
def test_activities |
|
| 22 |
assert_routing( |
|
| 23 |
{ :method => 'get', :path => "/activity" },
|
|
| 24 |
{ :controller => 'activities', :action => 'index' }
|
|
| 25 |
) |
|
| 26 |
assert_routing( |
|
| 27 |
{ :method => 'get', :path => "/activity.atom" },
|
|
| 28 |
{ :controller => 'activities', :action => 'index', :format => 'atom' }
|
|
| 29 |
) |
|
| 30 |
assert_routing( |
|
| 31 |
{ :method => 'get', :path => "/projects/33/activity" },
|
|
| 32 |
{ :controller => 'activities', :action => 'index', :id => '33' }
|
|
| 33 |
) |
|
| 34 |
assert_routing( |
|
| 35 |
{ :method => 'get', :path => "/projects/33/activity.atom" },
|
|
| 36 |
{ :controller => 'activities', :action => 'index', :id => '33',
|
|
| 37 |
:format => 'atom' } |
|
| 38 |
) |
|
| 39 |
end |
|
| 40 |
end |
|
| .svn/pristine/8d/8de4c797fceec75f448817f41a206125b1a2da6d.svn-base | ||
|---|---|---|
| 1 |
# Redmine - project management software |
|
| 2 |
# Copyright (C) 2006-2012 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::PluginTest < ActiveSupport::TestCase |
|
| 21 |
|
|
| 22 |
def setup |
|
| 23 |
@klass = Redmine::Plugin |
|
| 24 |
# In case some real plugins are installed |
|
| 25 |
@klass.clear |
|
| 26 |
end |
|
| 27 |
|
|
| 28 |
def teardown |
|
| 29 |
@klass.clear |
|
| 30 |
end |
|
| 31 |
|
|
| 32 |
def test_register |
|
| 33 |
@klass.register :foo do |
|
| 34 |
name 'Foo plugin' |
|
| 35 |
url 'http://example.net/plugins/foo' |
|
| 36 |
author 'John Smith' |
|
| 37 |
author_url 'http://example.net/jsmith' |
|
| 38 |
description 'This is a test plugin' |
|
| 39 |
version '0.0.1' |
|
| 40 |
settings :default => {'sample_setting' => 'value', 'foo'=>'bar'}, :partial => 'foo/settings'
|
|
| 41 |
end |
|
| 42 |
|
|
| 43 |
assert_equal 1, @klass.all.size |
|
| 44 |
|
|
| 45 |
plugin = @klass.find('foo')
|
|
| 46 |
assert plugin.is_a?(Redmine::Plugin) |
|
| 47 |
assert_equal :foo, plugin.id |
|
| 48 |
assert_equal 'Foo plugin', plugin.name |
|
| 49 |
assert_equal 'http://example.net/plugins/foo', plugin.url |
|
| 50 |
assert_equal 'John Smith', plugin.author |
|
| 51 |
assert_equal 'http://example.net/jsmith', plugin.author_url |
|
| 52 |
assert_equal 'This is a test plugin', plugin.description |
|
| 53 |
assert_equal '0.0.1', plugin.version |
|
| 54 |
end |
|
| 55 |
|
|
| 56 |
def test_installed |
|
| 57 |
@klass.register(:foo) {}
|
|
| 58 |
|
|
| 59 |
assert_equal true, @klass.installed?(:foo) |
|
| 60 |
assert_equal false, @klass.installed?(:bar) |
|
| 61 |
end |
|
| 62 |
|
|
| 63 |
def test_menu |
|
| 64 |
assert_difference 'Redmine::MenuManager.items(:project_menu).size' do |
|
| 65 |
@klass.register :foo do |
|
| 66 |
menu :project_menu, :foo_menu_item, '/foo', :caption => 'Foo' |
|
| 67 |
end |
|
| 68 |
end |
|
| 69 |
menu_item = Redmine::MenuManager.items(:project_menu).detect {|i| i.name == :foo_menu_item}
|
|
| 70 |
assert_not_nil menu_item |
|
| 71 |
assert_equal 'Foo', menu_item.caption |
|
| 72 |
assert_equal '/foo', menu_item.url |
|
| 73 |
end |
|
| 74 |
|
|
| 75 |
def test_delete_menu_item |
|
| 76 |
Redmine::MenuManager.map(:project_menu).push(:foo_menu_item, '/foo', :caption => 'Foo') |
|
| 77 |
|
|
| 78 |
assert_difference 'Redmine::MenuManager.items(:project_menu).size', -1 do |
|
| 79 |
@klass.register :foo do |
|
| 80 |
delete_menu_item :project_menu, :foo_menu_item |
|
| 81 |
end |
|
| 82 |
end |
|
| 83 |
assert_nil Redmine::MenuManager.items(:project_menu).detect {|i| i.name == :foo_menu_item}
|
|
| 84 |
end |
|
| 85 |
|
|
| 86 |
def test_requires_redmine |
|
| 87 |
plugin = Redmine::Plugin.register(:foo) {}
|
|
| 88 |
Redmine::VERSION.stubs(:to_a).returns([2, 1, 3, "stable", 10817]) |
|
| 89 |
|
|
| 90 |
# Specific version without hash |
|
| 91 |
assert plugin.requires_redmine('2.1.3')
|
|
| 92 |
assert plugin.requires_redmine('2.1')
|
|
| 93 |
assert_raise Redmine::PluginRequirementError do |
|
| 94 |
plugin.requires_redmine('2.1.4')
|
|
| 95 |
end |
|
| 96 |
assert_raise Redmine::PluginRequirementError do |
|
| 97 |
plugin.requires_redmine('2.2')
|
|
| 98 |
end |
|
| 99 |
|
|
| 100 |
# Specific version |
|
| 101 |
assert plugin.requires_redmine(:version => '2.1.3') |
|
| 102 |
assert plugin.requires_redmine(:version => ['2.1.3', '2.2.0']) |
|
| 103 |
assert plugin.requires_redmine(:version => '2.1') |
|
| 104 |
assert_raise Redmine::PluginRequirementError do |
|
| 105 |
plugin.requires_redmine(:version => '2.2.0') |
|
| 106 |
end |
|
| 107 |
assert_raise Redmine::PluginRequirementError do |
|
| 108 |
plugin.requires_redmine(:version => ['2.1.4', '2.2.0']) |
|
| 109 |
end |
|
| 110 |
assert_raise Redmine::PluginRequirementError do |
|
| 111 |
plugin.requires_redmine(:version => '2.2') |
|
| 112 |
end |
|
| 113 |
|
|
| 114 |
# Version range |
|
| 115 |
assert plugin.requires_redmine(:version => '2.0.0'..'2.2.4') |
|
| 116 |
assert plugin.requires_redmine(:version => '2.1.3'..'2.2.4') |
|
| 117 |
assert plugin.requires_redmine(:version => '2.0.0'..'2.1.3') |
|
| 118 |
assert plugin.requires_redmine(:version => '2.0'..'2.2') |
|
| 119 |
assert plugin.requires_redmine(:version => '2.1'..'2.2') |
|
| 120 |
assert plugin.requires_redmine(:version => '2.0'..'2.1') |
|
| 121 |
assert_raise Redmine::PluginRequirementError do |
|
| 122 |
plugin.requires_redmine(:version => '2.1.4'..'2.2.4') |
|
| 123 |
end |
|
| 124 |
|
|
| 125 |
|
|
| 126 |
# Version or higher |
|
| 127 |
assert plugin.requires_redmine(:version_or_higher => '0.1.0') |
|
| 128 |
assert plugin.requires_redmine(:version_or_higher => '2.1.3') |
|
| 129 |
assert plugin.requires_redmine(:version_or_higher => '2.1') |
|
| 130 |
assert_raise Redmine::PluginRequirementError do |
|
| 131 |
plugin.requires_redmine(:version_or_higher => '2.2.0') |
|
| 132 |
end |
|
| 133 |
assert_raise Redmine::PluginRequirementError do |
|
| 134 |
plugin.requires_redmine(:version_or_higher => '2.2') |
|
| 135 |
end |
|
| 136 |
end |
|
| 137 |
|
|
| 138 |
def test_requires_redmine_plugin |
|
| 139 |
test = self |
|
| 140 |
other_version = '0.5.0' |
|
| 141 |
|
|
| 142 |
@klass.register :other do |
|
| 143 |
name 'Other' |
|
| 144 |
version other_version |
|
| 145 |
end |
|
| 146 |
|
|
| 147 |
@klass.register :foo do |
|
| 148 |
test.assert requires_redmine_plugin(:other, :version_or_higher => '0.1.0') |
|
| 149 |
test.assert requires_redmine_plugin(:other, :version_or_higher => other_version) |
|
| 150 |
test.assert requires_redmine_plugin(:other, other_version) |
|
| 151 |
test.assert_raise Redmine::PluginRequirementError do |
|
| 152 |
requires_redmine_plugin(:other, :version_or_higher => '99.0.0') |
|
| 153 |
end |
|
| 154 |
|
|
| 155 |
test.assert requires_redmine_plugin(:other, :version => other_version) |
|
| 156 |
test.assert requires_redmine_plugin(:other, :version => [other_version, '99.0.0']) |
|
| 157 |
test.assert_raise Redmine::PluginRequirementError do |
|
| 158 |
requires_redmine_plugin(:other, :version => '99.0.0') |
|
| 159 |
end |
|
| 160 |
test.assert_raise Redmine::PluginRequirementError do |
|
| 161 |
requires_redmine_plugin(:other, :version => ['98.0.0', '99.0.0']) |
|
| 162 |
end |
|
| 163 |
# Missing plugin |
|
| 164 |
test.assert_raise Redmine::PluginNotFound do |
|
| 165 |
requires_redmine_plugin(:missing, :version_or_higher => '0.1.0') |
|
| 166 |
end |
|
| 167 |
test.assert_raise Redmine::PluginNotFound do |
|
| 168 |
requires_redmine_plugin(:missing, '0.1.0') |
|
| 169 |
end |
|
| 170 |
test.assert_raise Redmine::PluginNotFound do |
|
| 171 |
requires_redmine_plugin(:missing, :version => '0.1.0') |
|
| 172 |
end |
|
| 173 |
|
|
| 174 |
end |
|
| 175 |
end |
|
| 176 |
end |
|
| .svn/pristine/8d/8dfc36903ba9eb2357ea5f32787d3f3e79fe880c.svn-base | ||
|---|---|---|
| 1 |
module OpenIdAuthentication |
|
| 2 |
class Nonce < ActiveRecord::Base |
|
| 3 |
self.table_name = :open_id_authentication_nonces |
|
| 4 |
end |
|
| 5 |
end |
|
Also available in: Unified diff