@@ -0,0 +1,7 | |||||
|
1 | # Be sure to restart your server when you modify this file. | |||
|
2 | ||||
|
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. | |||
|
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } | |||
|
5 | ||||
|
6 | # You can also remove all the silencers if you're trying do debug a problem that might steem from framework code. | |||
|
7 | # Rails.backtrace_cleaner.remove_silencers! No newline at end of file |
@@ -0,0 +1,10 | |||||
|
1 | # Be sure to restart your server when you modify this file. | |||
|
2 | ||||
|
3 | # Add new inflection rules using the following format | |||
|
4 | # (all these examples are active by default): | |||
|
5 | # ActiveSupport::Inflector.inflections do |inflect| | |||
|
6 | # inflect.plural /^(ox)$/i, '\1en' | |||
|
7 | # inflect.singular /^(ox)en/i, '\1' | |||
|
8 | # inflect.irregular 'person', 'people' | |||
|
9 | # inflect.uncountable %w( fish sheep ) | |||
|
10 | # end |
@@ -0,0 +1,5 | |||||
|
1 | class AppAndPluginController < ApplicationController | |||
|
2 | def an_action | |||
|
3 | render_class_and_action 'from app' | |||
|
4 | end | |||
|
5 | end |
@@ -0,0 +1,5 | |||||
|
1 | class Namespace::AppAndPluginController < ApplicationController | |||
|
2 | def an_action | |||
|
3 | render_class_and_action 'from app' | |||
|
4 | end | |||
|
5 | end |
@@ -0,0 +1,5 | |||||
|
1 | module MailHelper | |||
|
2 | def do_something_helpful(var) | |||
|
3 | var.to_s.reverse | |||
|
4 | end | |||
|
5 | end No newline at end of file |
@@ -0,0 +1,3 | |||||
|
1 | class AppAndPluginModel < ActiveRecord::Base | |||
|
2 | def self.report_location; TestHelper::report_location(__FILE__); end | |||
|
3 | end No newline at end of file |
@@ -0,0 +1,26 | |||||
|
1 | class NotifyMail < ActionMailer::Base | |||
|
2 | ||||
|
3 | helper :mail | |||
|
4 | ||||
|
5 | def signup(txt) | |||
|
6 | body(:name => txt) | |||
|
7 | end | |||
|
8 | ||||
|
9 | def multipart | |||
|
10 | recipients 'some_address@email.com' | |||
|
11 | subject 'multi part email' | |||
|
12 | from "another_user@email.com" | |||
|
13 | content_type 'multipart/alternative' | |||
|
14 | ||||
|
15 | part :content_type => "text/html", :body => render_message("multipart_html", {}) | |||
|
16 | part "text/plain" do |p| | |||
|
17 | p.body = render_message("multipart_plain", {}) | |||
|
18 | end | |||
|
19 | end | |||
|
20 | ||||
|
21 | def implicit_multipart | |||
|
22 | recipients 'some_address@email.com' | |||
|
23 | subject 'multi part email' | |||
|
24 | from "another_user@email.com" | |||
|
25 | end | |||
|
26 | end No newline at end of file |
@@ -0,0 +1,3 | |||||
|
1 | class Thing | |||
|
2 | def self.from_app; TestHelper::report_location(__FILE__); end | |||
|
3 | end No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | <%= TestHelper.view_path_for __FILE__ %> (from app) No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | <%= TestHelper.view_path_for __FILE__ %> (from app) No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | the implicit html part of the email <%= do_something_helpful("semaj") %> No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | the implicit plaintext part of the email No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | the html part of the email <%= do_something_helpful("semaj") %> No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | the plaintext part of the email No newline at end of file |
@@ -0,0 +1,5 | |||||
|
1 | Signup template from application | |||
|
2 | ||||
|
3 | Here's a local variable set in the Mail object: <%= @name %>. | |||
|
4 | ||||
|
5 | And here's a method called in a mail helper: <%= do_something_helpful(@name) %> |
@@ -0,0 +1,1 | |||||
|
1 | <%= @note %> (from application) No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | plugin mail template loaded from application No newline at end of file |
@@ -0,0 +1,51 | |||||
|
1 | # Tests in this file ensure that: | |||
|
2 | # | |||
|
3 | # * plugin controller actions are found | |||
|
4 | # * actions defined in application controllers take precedence over those in plugins | |||
|
5 | # * actions in controllers in subsequently loaded plugins take precendence over those in previously loaded plugins | |||
|
6 | # * this works for actions in namespaced controllers accordingly | |||
|
7 | ||||
|
8 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
9 | ||||
|
10 | class ControllerLoadingTest < ActionController::TestCase | |||
|
11 | def setup | |||
|
12 | @request = ActionController::TestRequest.new | |||
|
13 | @response = ActionController::TestResponse.new | |||
|
14 | end | |||
|
15 | ||||
|
16 | # plugin controller actions should be found | |||
|
17 | ||||
|
18 | def test_WITH_an_action_defined_only_in_a_plugin_IT_should_use_this_action | |||
|
19 | get_action_on_controller :an_action, :alpha_plugin | |||
|
20 | assert_response_body 'rendered in AlphaPluginController#an_action' | |||
|
21 | end | |||
|
22 | ||||
|
23 | def test_WITH_an_action_defined_only_in_a_namespaced_plugin_controller_IT_should_use_this_action | |||
|
24 | get_action_on_controller :an_action, :alpha_plugin, :namespace | |||
|
25 | assert_response_body 'rendered in Namespace::AlphaPluginController#an_action' | |||
|
26 | end | |||
|
27 | ||||
|
28 | # app takes precedence over plugins | |||
|
29 | ||||
|
30 | def test_WITH_an_action_defined_in_both_app_and_plugin_IT_should_use_the_one_in_app | |||
|
31 | get_action_on_controller :an_action, :app_and_plugin | |||
|
32 | assert_response_body 'rendered in AppAndPluginController#an_action (from app)' | |||
|
33 | end | |||
|
34 | ||||
|
35 | def test_WITH_an_action_defined_in_namespaced_controllers_in_both_app_and_plugin_IT_should_use_the_one_in_app | |||
|
36 | get_action_on_controller :an_action, :app_and_plugin, :namespace | |||
|
37 | assert_response_body 'rendered in Namespace::AppAndPluginController#an_action (from app)' | |||
|
38 | end | |||
|
39 | ||||
|
40 | # subsequently loaded plugins take precendence over previously loaded plugins | |||
|
41 | ||||
|
42 | def test_WITH_an_action_defined_in_two_plugin_controllers_IT_should_use_the_latter_of_both | |||
|
43 | get_action_on_controller :an_action, :shared_plugin | |||
|
44 | assert_response_body 'rendered in SharedPluginController#an_action (from beta_plugin)' | |||
|
45 | end | |||
|
46 | ||||
|
47 | def test_WITH_an_action_defined_in_two_namespaced_plugin_controllers_IT_should_use_the_latter_of_both | |||
|
48 | get_action_on_controller :an_action, :shared_plugin, :namespace | |||
|
49 | assert_response_body 'rendered in Namespace::SharedPluginController#an_action (from beta_plugin)' | |||
|
50 | end | |||
|
51 | end |
@@ -0,0 +1,29 | |||||
|
1 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
2 | ||||
|
3 | class ExceptionNotificationCompatibilityTest < ActionController::TestCase | |||
|
4 | ExceptionNotifier.exception_recipients = %w(joe@schmoe.com bill@schmoe.com) | |||
|
5 | class SimpleController < ApplicationController | |||
|
6 | include ExceptionNotifiable | |||
|
7 | local_addresses.clear | |||
|
8 | consider_all_requests_local = false | |||
|
9 | def index | |||
|
10 | begin | |||
|
11 | raise "Fail!" | |||
|
12 | rescue Exception => e | |||
|
13 | rescue_action_in_public(e) | |||
|
14 | end | |||
|
15 | end | |||
|
16 | end | |||
|
17 | ||||
|
18 | def setup | |||
|
19 | @controller = SimpleController.new | |||
|
20 | @request = ActionController::TestRequest.new | |||
|
21 | @response = ActionController::TestResponse.new | |||
|
22 | end | |||
|
23 | ||||
|
24 | def test_should_work | |||
|
25 | assert_nothing_raised do | |||
|
26 | get :index | |||
|
27 | end | |||
|
28 | end | |||
|
29 | end No newline at end of file |
@@ -0,0 +1,26 | |||||
|
1 | # Tests in this file ensure that: | |||
|
2 | # | |||
|
3 | # * translations in the application take precedence over those in plugins | |||
|
4 | # * translations in subsequently loaded plugins take precendence over those in previously loaded plugins | |||
|
5 | ||||
|
6 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
7 | ||||
|
8 | class LocaleLoadingTest < ActionController::TestCase | |||
|
9 | def setup | |||
|
10 | @request = ActionController::TestRequest.new | |||
|
11 | @response = ActionController::TestResponse.new | |||
|
12 | end | |||
|
13 | ||||
|
14 | # app takes precedence over plugins | |||
|
15 | ||||
|
16 | def test_WITH_a_translation_defined_in_both_app_and_plugin_IT_should_find_the_one_in_app | |||
|
17 | assert_equal I18n.t('hello'), 'Hello world' | |||
|
18 | end | |||
|
19 | ||||
|
20 | # subsequently loaded plugins take precendence over previously loaded plugins | |||
|
21 | ||||
|
22 | def test_WITH_a_translation_defined_in_two_plugins_IT_should_find_the_latter_of_both | |||
|
23 | assert_equal I18n.t('plugin'), 'beta' | |||
|
24 | end | |||
|
25 | end | |||
|
26 |
@@ -0,0 +1,29 | |||||
|
1 | # Tests in this file ensure that: | |||
|
2 | # | |||
|
3 | # * Routes from plugins can be routed to | |||
|
4 | # * Named routes can be defined within a plugin | |||
|
5 | ||||
|
6 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
7 | ||||
|
8 | class RoutesTest < ActionController::TestCase | |||
|
9 | tests TestRoutingController | |||
|
10 | ||||
|
11 | def test_WITH_a_route_defined_in_a_plugin_IT_should_route_it | |||
|
12 | path = '/routes/an_action' | |||
|
13 | opts = {:controller => 'test_routing', :action => 'an_action'} | |||
|
14 | assert_routing path, opts | |||
|
15 | assert_recognizes opts, path # not sure what exactly the difference is, but it won't hurt either | |||
|
16 | end | |||
|
17 | ||||
|
18 | def test_WITH_a_route_for_a_namespaced_controller_defined_in_a_plugin_IT_should_route_it | |||
|
19 | path = 'somespace/routes/an_action' | |||
|
20 | opts = {:controller => 'namespace/test_routing', :action => 'an_action'} | |||
|
21 | assert_routing path, opts | |||
|
22 | assert_recognizes opts, path | |||
|
23 | end | |||
|
24 | ||||
|
25 | def test_should_properly_generate_named_routes | |||
|
26 | get :test_named_routes_from_plugin | |||
|
27 | assert_response_body '/somespace/routes' | |||
|
28 | end | |||
|
29 | end No newline at end of file |
@@ -0,0 +1,37 | |||||
|
1 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
2 | ||||
|
3 | class ViewHelpersTest < ActionController::TestCase | |||
|
4 | tests AssetsController | |||
|
5 | ||||
|
6 | def setup | |||
|
7 | get :index | |||
|
8 | end | |||
|
9 | ||||
|
10 | def test_plugin_javascript_helpers | |||
|
11 | base_selector = "script[type='text/javascript']" | |||
|
12 | js_dir = "/plugin_assets/test_assets/javascripts" | |||
|
13 | assert_select "#{base_selector}[src='#{js_dir}/file.1.js']" | |||
|
14 | assert_select "#{base_selector}[src='#{js_dir}/file2.js']" | |||
|
15 | end | |||
|
16 | ||||
|
17 | def test_plugin_stylesheet_helpers | |||
|
18 | base_selector = "link[media='screen'][rel='stylesheet'][type='text/css']" | |||
|
19 | css_dir = "/plugin_assets/test_assets/stylesheets" | |||
|
20 | assert_select "#{base_selector}[href='#{css_dir}/file.1.css']" | |||
|
21 | assert_select "#{base_selector}[href='#{css_dir}/file2.css']" | |||
|
22 | end | |||
|
23 | ||||
|
24 | def test_plugin_image_helpers | |||
|
25 | assert_select "img[src='/plugin_assets/test_assets/images/image.png'][alt='Image']" | |||
|
26 | end | |||
|
27 | ||||
|
28 | def test_plugin_layouts | |||
|
29 | get :index | |||
|
30 | assert_select "div[id='assets_layout']" | |||
|
31 | end | |||
|
32 | ||||
|
33 | def test_plugin_image_submit_helpers | |||
|
34 | assert_select "input[src='/plugin_assets/test_assets/images/image.png'][type='image']" | |||
|
35 | end | |||
|
36 | ||||
|
37 | end |
@@ -0,0 +1,60 | |||||
|
1 | # Tests in this file ensure that: | |||
|
2 | # | |||
|
3 | # * plugin views are found | |||
|
4 | # * views in the application take precedence over those in plugins | |||
|
5 | # * views in subsequently loaded plugins take precendence over those in previously loaded plugins | |||
|
6 | # * this works for namespaced views accordingly | |||
|
7 | ||||
|
8 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
9 | ||||
|
10 | class ViewLoadingTest < ActionController::TestCase | |||
|
11 | def setup | |||
|
12 | @request = ActionController::TestRequest.new | |||
|
13 | @response = ActionController::TestResponse.new | |||
|
14 | end | |||
|
15 | ||||
|
16 | # plugin views should be found | |||
|
17 | ||||
|
18 | def test_WITH_a_view_defined_only_in_a_plugin_IT_should_find_the_view | |||
|
19 | get_action_on_controller :a_view, :alpha_plugin | |||
|
20 | assert_response_body 'alpha_plugin/a_view' | |||
|
21 | end | |||
|
22 | ||||
|
23 | def test_WITH_a_namespaced_view_defined_only_in_a_plugin_IT_should_find_the_view | |||
|
24 | get_action_on_controller :a_view, :alpha_plugin, :namespace | |||
|
25 | assert_response_body 'namespace/alpha_plugin/a_view' | |||
|
26 | end | |||
|
27 | ||||
|
28 | # app takes precedence over plugins | |||
|
29 | ||||
|
30 | def test_WITH_a_view_defined_in_both_app_and_plugin_IT_should_find_the_one_in_app | |||
|
31 | get_action_on_controller :a_view, :app_and_plugin | |||
|
32 | assert_response_body 'app_and_plugin/a_view (from app)' | |||
|
33 | end | |||
|
34 | ||||
|
35 | def test_WITH_a_namespaced_view_defined_in_both_app_and_plugin_IT_should_find_the_one_in_app | |||
|
36 | get_action_on_controller :a_view, :app_and_plugin, :namespace | |||
|
37 | assert_response_body 'namespace/app_and_plugin/a_view (from app)' | |||
|
38 | end | |||
|
39 | ||||
|
40 | # subsequently loaded plugins take precendence over previously loaded plugins | |||
|
41 | ||||
|
42 | def test_WITH_a_view_defined_in_two_plugins_IT_should_find_the_latter_of_both | |||
|
43 | get_action_on_controller :a_view, :shared_plugin | |||
|
44 | assert_response_body 'shared_plugin/a_view (from beta_plugin)' | |||
|
45 | end | |||
|
46 | ||||
|
47 | def test_WITH_a_namespaced_view_defined_in_two_plugins_IT_should_find_the_latter_of_both | |||
|
48 | get_action_on_controller :a_view, :shared_plugin, :namespace | |||
|
49 | assert_response_body 'namespace/shared_plugin/a_view (from beta_plugin)' | |||
|
50 | end | |||
|
51 | ||||
|
52 | # layouts loaded from plugins | |||
|
53 | ||||
|
54 | def test_should_be_able_to_load_a_layout_from_a_plugin | |||
|
55 | get_action_on_controller :action_with_layout, :alpha_plugin | |||
|
56 | assert_response_body 'rendered in AlphaPluginController#action_with_layout (with plugin layout)' | |||
|
57 | end | |||
|
58 | ||||
|
59 | end | |||
|
60 | No newline at end of file |
@@ -0,0 +1,3 | |||||
|
1 | class AppAndPluginLibModel < ActiveRecord::Base | |||
|
2 | def self.report_location; TestHelper::report_location(__FILE__); end | |||
|
3 | end No newline at end of file |
@@ -0,0 +1,42 | |||||
|
1 | module TestHelper | |||
|
2 | def self.report_location(path) | |||
|
3 | [RAILS_ROOT + '/', 'vendor/plugins/'].each { |part| path.sub! part, ''} | |||
|
4 | path = path.split('/') | |||
|
5 | location, subject = path.first, path.last | |||
|
6 | if subject.sub! '.rb', '' | |||
|
7 | subject = subject.classify | |||
|
8 | else | |||
|
9 | subject.sub! '.html.erb', '' | |||
|
10 | end | |||
|
11 | "#{subject} (from #{location})" | |||
|
12 | end | |||
|
13 | ||||
|
14 | def self.view_path_for path | |||
|
15 | [RAILS_ROOT + '/', 'vendor/plugins/', '.html.erb'].each { |part| path.sub! part, ''} | |||
|
16 | parts = path.split('/') | |||
|
17 | parts[(parts.index('views')+1)..-1].join('/') | |||
|
18 | end | |||
|
19 | end | |||
|
20 | ||||
|
21 | class Test::Unit::TestCase | |||
|
22 | # Add more helper methods to be used by all tests here... | |||
|
23 | def get_action_on_controller(*args) | |||
|
24 | action = args.shift | |||
|
25 | with_controller *args | |||
|
26 | get action | |||
|
27 | end | |||
|
28 | ||||
|
29 | def with_controller(controller, namespace = nil) | |||
|
30 | classname = controller.to_s.classify + 'Controller' | |||
|
31 | classname = namespace.to_s.classify + '::' + classname unless namespace.nil? | |||
|
32 | @controller = classname.constantize.new | |||
|
33 | end | |||
|
34 | ||||
|
35 | def assert_response_body(expected) | |||
|
36 | assert_equal expected, @response.body | |||
|
37 | end | |||
|
38 | end | |||
|
39 | ||||
|
40 | # Because we're testing this behaviour, we actually want these features on! | |||
|
41 | Engines.disable_application_view_loading = false | |||
|
42 | Engines.disable_application_code_loading = false |
@@ -0,0 +1,7 | |||||
|
1 | module RenderInformation | |||
|
2 | def render_class_and_action(note = nil, options={}) | |||
|
3 | text = "rendered in #{self.class.name}##{params[:action]}" | |||
|
4 | text += " (#{note})" unless note.nil? | |||
|
5 | render options.update(:text => text) | |||
|
6 | end | |||
|
7 | end No newline at end of file |
@@ -0,0 +1,8 | |||||
|
1 | class AlphaPluginController < ApplicationController | |||
|
2 | def an_action | |||
|
3 | render_class_and_action | |||
|
4 | end | |||
|
5 | def action_with_layout | |||
|
6 | render_class_and_action(nil, :layout => "plugin_layout") | |||
|
7 | end | |||
|
8 | end |
@@ -0,0 +1,5 | |||||
|
1 | class AppAndPluginController < ApplicationController | |||
|
2 | def an_action | |||
|
3 | render_class_and_action 'from alpha_plugin' | |||
|
4 | end | |||
|
5 | end |
@@ -0,0 +1,5 | |||||
|
1 | class Namespace::AlphaPluginController < ApplicationController | |||
|
2 | def an_action | |||
|
3 | render_class_and_action | |||
|
4 | end | |||
|
5 | end No newline at end of file |
@@ -0,0 +1,5 | |||||
|
1 | class Namespace::AppAndPluginController < ApplicationController | |||
|
2 | def an_action | |||
|
3 | render_class_and_action 'from alpha_plugin' | |||
|
4 | end | |||
|
5 | end |
@@ -0,0 +1,5 | |||||
|
1 | class Namespace::SharedPluginController < ApplicationController | |||
|
2 | def an_action | |||
|
3 | render_class_and_action 'from alpha_plugin' | |||
|
4 | end | |||
|
5 | end |
@@ -0,0 +1,5 | |||||
|
1 | class SharedEngineController < ApplicationController | |||
|
2 | def an_action | |||
|
3 | render_class_and_action 'from alpha_engine' | |||
|
4 | end | |||
|
5 | end |
@@ -0,0 +1,3 | |||||
|
1 | class AlphaPluginModel < ActiveRecord::Base | |||
|
2 | def self.report_location; TestHelper::report_location(__FILE__); end | |||
|
3 | end No newline at end of file |
@@ -0,0 +1,7 | |||||
|
1 | class AppAndPluginModel < ActiveRecord::Base | |||
|
2 | def self.report_location; TestHelper::report_location(__FILE__); end | |||
|
3 | ||||
|
4 | def defined_only_in_alpha_plugin_version | |||
|
5 | # should not be defined as the model in app/models takes precedence | |||
|
6 | end | |||
|
7 | end No newline at end of file |
@@ -0,0 +1,3 | |||||
|
1 | class SharedPluginModel < ActiveRecord::Base | |||
|
2 | def self.report_location; TestHelper::report_location(__FILE__); end | |||
|
3 | end No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | <%= TestHelper.view_path_for __FILE__ %> No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | <%= TestHelper.view_path_for __FILE__ %> (from a_view) No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | <%= yield %> (with plugin layout) No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | <%= TestHelper.view_path_for __FILE__ %> No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | <%= TestHelper.view_path_for __FILE__ %> No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | <%= TestHelper.view_path_for __FILE__ %> (from alpha_plugin) No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | <%= TestHelper.view_path_for __FILE__ %> (from alpha_plugin) No newline at end of file |
@@ -0,0 +1,3 | |||||
|
1 | class AlphaPluginLibModel < ActiveRecord::Base | |||
|
2 | def self.report_location; TestHelper::report_location(__FILE__); end | |||
|
3 | end No newline at end of file |
@@ -0,0 +1,7 | |||||
|
1 | class AppAndPluginLibModel < ActiveRecord::Base | |||
|
2 | def self.report_location; TestHelper::report_location(__FILE__); end | |||
|
3 | ||||
|
4 | def defined_only_in_alpha_plugin_version | |||
|
5 | # should not be defined | |||
|
6 | end | |||
|
7 | end No newline at end of file |
@@ -0,0 +1,5 | |||||
|
1 | class AppAndPluginController < ApplicationController | |||
|
2 | def an_action | |||
|
3 | render_class_and_action 'from beta_plugin' | |||
|
4 | end | |||
|
5 | end |
@@ -0,0 +1,5 | |||||
|
1 | class Namespace::SharedPluginController < ApplicationController | |||
|
2 | def an_action | |||
|
3 | render_class_and_action 'from beta_plugin' | |||
|
4 | end | |||
|
5 | end |
@@ -0,0 +1,5 | |||||
|
1 | class SharedPluginController < ApplicationController | |||
|
2 | def an_action | |||
|
3 | render_class_and_action 'from beta_plugin' | |||
|
4 | end | |||
|
5 | end |
@@ -0,0 +1,3 | |||||
|
1 | class SharedPluginModel < ActiveRecord::Base | |||
|
2 | def self.report_location; TestHelper::report_location(__FILE__); end | |||
|
3 | end No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | <%= TestHelper.view_path_for __FILE__ %> (from beta_plugin) No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | <%= TestHelper.view_path_for __FILE__ %> (from beta_plugin) No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | # just here so that Rails recognizes this as a plugin No newline at end of file |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
@@ -0,0 +1,4 | |||||
|
1 | <%= image_tag 'image.png', :plugin => 'test_assets' %> | |||
|
2 | <%= javascript_include_tag 'file.1.js', 'file2', :plugin => "test_assets" %> | |||
|
3 | <%= stylesheet_link_tag 'file.1.css', 'file2', :plugin => "test_assets" %> | |||
|
4 | <%= image_submit_tag 'image.png', :plugin => "test_assets" %> |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
@@ -0,0 +1,3 | |||||
|
1 | class Thing | |||
|
2 | def self.from_plugin; TestHelper::report_location(__FILE__); end | |||
|
3 | end No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | # just here so that Rails recognizes this as a plugin No newline at end of file |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
@@ -0,0 +1,11 | |||||
|
1 | class CreateTests < ActiveRecord::Migration | |||
|
2 | def self.up | |||
|
3 | create_table 'tests' do |t| | |||
|
4 | t.column 'name', :string | |||
|
5 | end | |||
|
6 | end | |||
|
7 | ||||
|
8 | def self.down | |||
|
9 | drop_table 'tests' | |||
|
10 | end | |||
|
11 | end |
@@ -0,0 +1,11 | |||||
|
1 | class CreateOthers < ActiveRecord::Migration | |||
|
2 | def self.up | |||
|
3 | create_table 'others' do |t| | |||
|
4 | t.column 'name', :string | |||
|
5 | end | |||
|
6 | end | |||
|
7 | ||||
|
8 | def self.down | |||
|
9 | drop_table 'others' | |||
|
10 | end | |||
|
11 | end |
@@ -0,0 +1,11 | |||||
|
1 | class CreateExtras < ActiveRecord::Migration | |||
|
2 | def self.up | |||
|
3 | create_table 'extras' do |t| | |||
|
4 | t.column 'name', :string | |||
|
5 | end | |||
|
6 | end | |||
|
7 | ||||
|
8 | def self.down | |||
|
9 | drop_table 'extras' | |||
|
10 | end | |||
|
11 | end |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
@@ -0,0 +1,26 | |||||
|
1 | class PluginMail < ActionMailer::Base | |||
|
2 | def mail_from_plugin(note=nil) | |||
|
3 | body(:note => note) | |||
|
4 | end | |||
|
5 | ||||
|
6 | def mail_from_plugin_with_application_template(note=nil) | |||
|
7 | body(:note => note) | |||
|
8 | end | |||
|
9 | ||||
|
10 | def multipart_from_plugin | |||
|
11 | content_type 'multipart/alternative' | |||
|
12 | part :content_type => "text/html", :body => render_message("multipart_from_plugin_html", {}) | |||
|
13 | part "text/plain" do |p| | |||
|
14 | p.body = render_message("multipart_from_plugin_plain", {}) | |||
|
15 | end | |||
|
16 | end | |||
|
17 | ||||
|
18 | def multipart_from_plugin_with_application_template | |||
|
19 | content_type 'multipart/alternative' | |||
|
20 | part :content_type => "text/html", :body => render_message("multipart_from_plugin_with_application_template_html", {}) | |||
|
21 | part "text/plain" do |p| | |||
|
22 | p.body = render_message("multipart_from_plugin_with_application_template_plain", {}) | |||
|
23 | end | |||
|
24 | end | |||
|
25 | ||||
|
26 | end No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | <%= @note %> No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | html template No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | plain template No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | template from plugin No newline at end of file |
@@ -0,0 +1,1 | |||||
|
1 | template from plugin No newline at end of file |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
@@ -0,0 +1,5 | |||||
|
1 | class Namespace::TestRoutingController < ApplicationController | |||
|
2 | def routed_action | |||
|
3 | render_class_and_action | |||
|
4 | end | |||
|
5 | end No newline at end of file |
@@ -0,0 +1,9 | |||||
|
1 | class TestRoutingController < ApplicationController | |||
|
2 | def routed_action | |||
|
3 | render_class_and_action | |||
|
4 | end | |||
|
5 | ||||
|
6 | def test_named_routes_from_plugin | |||
|
7 | render :text => plugin_route_path(:action => "index") | |||
|
8 | end | |||
|
9 | end No newline at end of file |
@@ -0,0 +1,4 | |||||
|
1 | ActionController::Routing::Routes.draw do |map| | |||
|
2 | map.connect 'routes/:action', :controller => "test_routing" | |||
|
3 | map.plugin_route 'somespace/routes/:action', :controller => "namespace/test_routing" | |||
|
4 | end No newline at end of file |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
@@ -0,0 +1,1 | |||||
|
1 | Fixtures are only copied from plugins with an +app+ directory, but git needs this directory to be non-empty No newline at end of file |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
@@ -0,0 +1,13 | |||||
|
1 | require File.expand_path(File.join(File.dirname(__FILE__), *%w[.. .. .. .. .. test test_helper])) | |||
|
2 | ||||
|
3 | class OverrideTest < ActiveSupport::TestCase | |||
|
4 | def test_overrides_from_the_application_should_work | |||
|
5 | flunk "this test should be overridden by the app" | |||
|
6 | end | |||
|
7 | ||||
|
8 | def test_tests_within_the_plugin_should_still_run | |||
|
9 | assert true, "non-overridden plugin tests should still run" | |||
|
10 | end | |||
|
11 | end | |||
|
12 | ||||
|
13 | Engines::Testing.override_tests_from_app No newline at end of file |
@@ -0,0 +1,54 | |||||
|
1 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
2 | ||||
|
3 | class ActionMailerWithinApplicationTest < Test::Unit::TestCase | |||
|
4 | ||||
|
5 | def test_normal_implicit_template | |||
|
6 | m = NotifyMail.create_signup("hello") | |||
|
7 | assert m.body =~ /^Signup template from application/ | |||
|
8 | end | |||
|
9 | ||||
|
10 | def test_action_mailer_can_get_helper | |||
|
11 | m = NotifyMail.create_signup('James') | |||
|
12 | assert m.body =~ /James/ | |||
|
13 | assert m.body =~ /semaJ/ # from the helper | |||
|
14 | end | |||
|
15 | ||||
|
16 | def test_multipart_mails_with_explicit_templates | |||
|
17 | m = NotifyMail.create_multipart | |||
|
18 | assert_equal 2, m.parts.length | |||
|
19 | assert_equal 'the html part of the email james', m.parts[0].body | |||
|
20 | assert_equal 'the plaintext part of the email', m.parts[1].body | |||
|
21 | end | |||
|
22 | ||||
|
23 | def test_multipart_mails_with_implicit_templates | |||
|
24 | m = NotifyMail.create_implicit_multipart | |||
|
25 | assert_equal 2, m.parts.length | |||
|
26 | assert_equal 'the implicit plaintext part of the email', m.parts[0].body | |||
|
27 | assert_equal 'the implicit html part of the email james', m.parts[1].body | |||
|
28 | end | |||
|
29 | end | |||
|
30 | ||||
|
31 | ||||
|
32 | class ActionMailerWithinPluginsTest < Test::Unit::TestCase | |||
|
33 | def test_should_be_able_to_create_mails_from_plugin | |||
|
34 | m = PluginMail.create_mail_from_plugin("from_plugin") | |||
|
35 | assert_equal "from_plugin", m.body | |||
|
36 | end | |||
|
37 | ||||
|
38 | def test_should_be_able_to_overload_views_within_the_application | |||
|
39 | m = PluginMail.create_mail_from_plugin_with_application_template("from_plugin") | |||
|
40 | assert_equal "from_plugin (from application)", m.body | |||
|
41 | end | |||
|
42 | ||||
|
43 | def test_should_be_able_to_create_a_multipart_mail_from_within_plugin | |||
|
44 | m = PluginMail.create_multipart_from_plugin | |||
|
45 | assert_equal 2, m.parts.length | |||
|
46 | assert_equal 'html template', m.parts[0].body | |||
|
47 | assert_equal 'plain template', m.parts[1].body | |||
|
48 | end | |||
|
49 | ||||
|
50 | def test_plugin_mailer_template_overriding | |||
|
51 | m = PluginMail.create_multipart_from_plugin_with_application_template | |||
|
52 | assert_equal 'plugin mail template loaded from application', m.parts[1].body | |||
|
53 | end | |||
|
54 | end No newline at end of file |
@@ -0,0 +1,41 | |||||
|
1 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
2 | ||||
|
3 | class ArbitraryCodeMixingTest < Test::Unit::TestCase | |||
|
4 | def setup | |||
|
5 | Engines.code_mixing_file_types = %w(controller helper) | |||
|
6 | end | |||
|
7 | ||||
|
8 | def test_should_allow_setting_of_different_code_mixing_file_types | |||
|
9 | assert_nothing_raised { | |||
|
10 | Engines.mix_code_from :things | |||
|
11 | } | |||
|
12 | end | |||
|
13 | ||||
|
14 | def test_should_add_new_types_to_existing_code_mixing_file_types | |||
|
15 | Engines.mix_code_from :things | |||
|
16 | assert_equal ["controller", "helper", "thing"], Engines.code_mixing_file_types | |||
|
17 | Engines.mix_code_from :other | |||
|
18 | assert_equal ["controller", "helper", "thing", "other"], Engines.code_mixing_file_types | |||
|
19 | end | |||
|
20 | ||||
|
21 | def test_should_allow_setting_of_multiple_types_at_once | |||
|
22 | Engines.mix_code_from :things, :other | |||
|
23 | assert_equal ["controller", "helper", "thing", "other"], Engines.code_mixing_file_types | |||
|
24 | end | |||
|
25 | ||||
|
26 | def test_should_singularize_elements_to_be_mixed | |||
|
27 | # this is the only test using mocha, so let's try to work around it | |||
|
28 | # also, this seems to be already tested with the :things in the tests above | |||
|
29 | # arg = stub(:to_s => stub(:singularize => "element")) | |||
|
30 | Engines.mix_code_from :elements | |||
|
31 | assert Engines.code_mixing_file_types.include?("element") | |||
|
32 | end | |||
|
33 | ||||
|
34 | # TODO doesn't seem to work as expected? | |||
|
35 | ||||
|
36 | # def test_should_successfully_mix_custom_types | |||
|
37 | # Engines.mix_code_from :things | |||
|
38 | # assert_equal 'Thing (from app)', Thing.from_app | |||
|
39 | # assert_equal 'Thing (from test_code_mixing)', Thing.from_plugin | |||
|
40 | # end | |||
|
41 | end No newline at end of file |
@@ -0,0 +1,52 | |||||
|
1 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
2 | ||||
|
3 | class AssetsTest < Test::Unit::TestCase | |||
|
4 | def setup | |||
|
5 | Engines::Assets.mirror_files_for Engines.plugins[:test_assets] | |||
|
6 | end | |||
|
7 | ||||
|
8 | def teardown | |||
|
9 | FileUtils.rm_r(Engines.public_directory) if File.exist?(Engines.public_directory) | |||
|
10 | end | |||
|
11 | ||||
|
12 | def test_engines_has_created_base_public_file | |||
|
13 | assert File.exist?(Engines.public_directory) | |||
|
14 | end | |||
|
15 | ||||
|
16 | def test_engines_has_created_README_in_public_directory | |||
|
17 | assert File.exist?(File.join(Engines.public_directory, 'README')) | |||
|
18 | end | |||
|
19 | ||||
|
20 | def test_public_files_have_been_copied_from_test_assets_plugin | |||
|
21 | assert File.exist?(File.join(Engines.public_directory, 'test_assets')) | |||
|
22 | assert File.exist?(File.join(Engines.public_directory, 'test_assets', 'file.txt')) | |||
|
23 | assert File.exist?(File.join(Engines.public_directory, 'test_assets', 'subfolder')) | |||
|
24 | assert File.exist?(File.join(Engines.public_directory, 'test_assets', 'subfolder', 'file_in_subfolder.txt')) | |||
|
25 | end | |||
|
26 | ||||
|
27 | def test_engines_has_not_created_duplicated_file_structure | |||
|
28 | assert !File.exists?(File.join(Engines.public_directory, "test_assets", RAILS_ROOT)) | |||
|
29 | end | |||
|
30 | ||||
|
31 | def test_public_files_have_been_copied_from_test_assets_with_assets_dir_plugin | |||
|
32 | Engines::Assets.mirror_files_for Engines.plugins[:test_assets_with_assets_directory] | |||
|
33 | ||||
|
34 | assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_assets_directory')) | |||
|
35 | assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_assets_directory', 'file.txt')) | |||
|
36 | assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_assets_directory', 'subfolder')) | |||
|
37 | assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_assets_directory', 'subfolder', 'file_in_subfolder.txt')) | |||
|
38 | end | |||
|
39 | ||||
|
40 | def test_public_files_have_been_copied_from_test_assets_with_no_subdirectory_plugin | |||
|
41 | Engines::Assets.mirror_files_for Engines.plugins[:test_assets_with_no_subdirectory] | |||
|
42 | ||||
|
43 | assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_no_subdirectory')) | |||
|
44 | assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_no_subdirectory', 'file.txt')) | |||
|
45 | end | |||
|
46 | ||||
|
47 | def test_public_files_have_NOT_been_copied_from_plugins_without_public_or_asset_directories | |||
|
48 | Engines::Assets.mirror_files_for Engines.plugins[:alpha_plugin] | |||
|
49 | ||||
|
50 | assert !File.exist?(File.join(Engines.public_directory, 'alpha_plugin')) | |||
|
51 | end | |||
|
52 | end No newline at end of file |
@@ -0,0 +1,8 | |||||
|
1 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
2 | ||||
|
3 | class BackwardsCompatibilityTest < Test::Unit::TestCase | |||
|
4 | def test_rails_module_plugin_method_should_delegate_to_engines_plugins | |||
|
5 | assert_nothing_raised { Rails.plugins } | |||
|
6 | assert_equal Engines.plugins, Rails.plugins | |||
|
7 | end | |||
|
8 | end No newline at end of file |
@@ -0,0 +1,58 | |||||
|
1 | # Tests in this file ensure that: | |||
|
2 | # | |||
|
3 | # * the application /app/[controllers|helpers|models] and /lib | |||
|
4 | # paths preceed the corresponding plugin paths | |||
|
5 | # * the plugin paths are added to $LOAD_PATH in the order in which plugins are | |||
|
6 | # loaded | |||
|
7 | ||||
|
8 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
9 | ||||
|
10 | class LoadPathTest < Test::Unit::TestCase | |||
|
11 | def setup | |||
|
12 | @load_path = expand_paths($LOAD_PATH) | |||
|
13 | end | |||
|
14 | ||||
|
15 | # Not sure if these test actually make sense as this now essentially tests | |||
|
16 | # Rails core functionality. On the other hand Engines relies on this to some | |||
|
17 | # extend so this will choke if something important changes in Rails. | |||
|
18 | ||||
|
19 | # the application app/... and lib/ directories should appear | |||
|
20 | # before any plugin directories | |||
|
21 | ||||
|
22 | def test_application_app_libs_should_precede_all_plugin_app_libs | |||
|
23 | types = %w(app/controllers app/helpers app/models lib) | |||
|
24 | types.each do |t| | |||
|
25 | app_index = load_path_index(File.join(RAILS_ROOT, t)) | |||
|
26 | assert_not_nil app_index, "#{t} is missing in $LOAD_PATH" | |||
|
27 | Engines.plugins.each do |plugin| | |||
|
28 | first_plugin_index = load_path_index(File.join(plugin.directory, t)) | |||
|
29 | assert(app_index < first_plugin_index) unless first_plugin_index.nil? | |||
|
30 | end | |||
|
31 | end | |||
|
32 | end | |||
|
33 | ||||
|
34 | # the engine directories should appear in the proper order based on | |||
|
35 | # the order they were started | |||
|
36 | ||||
|
37 | def test_plugin_dirs_should_appear_in_reverse_plugin_loading_order | |||
|
38 | app_paths = %w(app/controllers/ app app/models app/helpers lib) | |||
|
39 | app_paths.map { |p| File.join(RAILS_ROOT, p)} | |||
|
40 | plugin_paths = Engines.plugins.reverse.collect { |plugin| plugin.load_paths.reverse }.flatten | |||
|
41 | ||||
|
42 | expected_paths = expand_paths(app_paths + plugin_paths) | |||
|
43 | # only look at those paths that are also present in expected_paths so | |||
|
44 | # the only difference would be in the order of the paths | |||
|
45 | actual_paths = @load_path & expected_paths | |||
|
46 | ||||
|
47 | assert_equal expected_paths, actual_paths | |||
|
48 | end | |||
|
49 | ||||
|
50 | protected | |||
|
51 | def expand_paths(paths) | |||
|
52 | paths.collect { |p| File.expand_path(p) } | |||
|
53 | end | |||
|
54 | ||||
|
55 | def load_path_index(dir) | |||
|
56 | @load_path.index(File.expand_path(dir)) | |||
|
57 | end | |||
|
58 | end No newline at end of file |
@@ -0,0 +1,63 | |||||
|
1 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
2 | require 'rails_generator' | |||
|
3 | require 'rails_generator/scripts/generate' | |||
|
4 | ||||
|
5 | class MigrationsTest < Test::Unit::TestCase | |||
|
6 | ||||
|
7 | @@migration_dir = "#{RAILS_ROOT}/db/migrate" | |||
|
8 | ||||
|
9 | def setup | |||
|
10 | ActiveRecord::Migration.verbose = false | |||
|
11 | Engines.plugins[:test_migration].migrate(0) | |||
|
12 | end | |||
|
13 | ||||
|
14 | def teardown | |||
|
15 | FileUtils.rm_r(@@migration_dir) if File.exist?(@@migration_dir) | |||
|
16 | end | |||
|
17 | ||||
|
18 | def test_engine_migrations_can_run_down | |||
|
19 | assert !table_exists?('tests'), ActiveRecord::Base.connection.tables.inspect | |||
|
20 | assert !table_exists?('others'), ActiveRecord::Base.connection.tables.inspect | |||
|
21 | assert !table_exists?('extras'), ActiveRecord::Base.connection.tables.inspect | |||
|
22 | end | |||
|
23 | ||||
|
24 | def test_engine_migrations_can_run_up | |||
|
25 | Engines.plugins[:test_migration].migrate(3) | |||
|
26 | assert table_exists?('tests') | |||
|
27 | assert table_exists?('others') | |||
|
28 | assert table_exists?('extras') | |||
|
29 | end | |||
|
30 | ||||
|
31 | def test_engine_migrations_can_upgrade_incrementally | |||
|
32 | Engines.plugins[:test_migration].migrate(1) | |||
|
33 | assert table_exists?('tests') | |||
|
34 | assert !table_exists?('others') | |||
|
35 | assert !table_exists?('extras') | |||
|
36 | assert_equal 1, Engines::Plugin::Migrator.current_version(Engines.plugins[:test_migration]) | |||
|
37 | ||||
|
38 | ||||
|
39 | Engines.plugins[:test_migration].migrate(2) | |||
|
40 | assert table_exists?('others') | |||
|
41 | assert_equal 2, Engines::Plugin::Migrator.current_version(Engines.plugins[:test_migration]) | |||
|
42 | ||||
|
43 | ||||
|
44 | Engines.plugins[:test_migration].migrate(3) | |||
|
45 | assert table_exists?('extras') | |||
|
46 | assert_equal 3, Engines::Plugin::Migrator.current_version(Engines.plugins[:test_migration]) | |||
|
47 | end | |||
|
48 | ||||
|
49 | def test_generator_creates_plugin_migration_file | |||
|
50 | Rails::Generator::Scripts::Generate.new.run(['plugin_migration', 'test_migration'], :quiet => true) | |||
|
51 | assert migration_file, "migration file is missing" | |||
|
52 | end | |||
|
53 | ||||
|
54 | private | |||
|
55 | ||||
|
56 | def table_exists?(table) | |||
|
57 | ActiveRecord::Base.connection.tables.include?(table) | |||
|
58 | end | |||
|
59 | ||||
|
60 | def migration_file | |||
|
61 | Dir["#{@@migration_dir}/*test_migration_to_version_3.rb"][0] | |||
|
62 | end | |||
|
63 | end No newline at end of file |
@@ -0,0 +1,37 | |||||
|
1 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
2 | ||||
|
3 | class ModelAndLibTest < Test::Unit::TestCase | |||
|
4 | ||||
|
5 | def test_WITH_a_model_defined_only_in_a_plugin_IT_should_load_the_model | |||
|
6 | assert_equal 'AlphaPluginModel (from alpha_plugin)', AlphaPluginModel.report_location | |||
|
7 | end | |||
|
8 | ||||
|
9 | def test_WITH_a_model_defined_only_in_a_plugin_lib_dir_IT_should_load_the_model | |||
|
10 | assert_equal 'AlphaPluginLibModel (from alpha_plugin)', AlphaPluginLibModel.report_location | |||
|
11 | end | |||
|
12 | ||||
|
13 | # app takes precedence over plugins | |||
|
14 | ||||
|
15 | def test_WITH_a_model_defined_in_both_app_and_plugin_IT_should_load_the_one_in_app | |||
|
16 | assert_equal 'AppAndPluginModel (from app)', AppAndPluginModel.report_location | |||
|
17 | assert_raises(NoMethodError) { AppAndPluginLibModel.defined_only_in_alpha_engine_version } | |||
|
18 | end | |||
|
19 | ||||
|
20 | def test_WITH_a_model_defined_in_both_app_and_plugin_lib_dirs_IT_should_load_the_one_in_app | |||
|
21 | assert_equal 'AppAndPluginLibModel (from lib)', AppAndPluginLibModel.report_location | |||
|
22 | assert_raises(NoMethodError) { AppAndPluginLibModel.defined_only_in_alpha_engine_version } | |||
|
23 | end | |||
|
24 | ||||
|
25 | # subsequently loaded plugins take precendence over previously loaded plugins | |||
|
26 | ||||
|
27 | # TODO | |||
|
28 | # | |||
|
29 | # this does work when we rely on $LOAD_PATH while it won't work when we use | |||
|
30 | # Dependency constant autoloading. This somewhat confusing difference has | |||
|
31 | # been there since at least Rails 1.2.x. See http://www.ruby-forum.com/topic/134529 | |||
|
32 | ||||
|
33 | def test_WITH_a_model_defined_in_two_plugins_IT_should_load_the_latter_of_both | |||
|
34 | require 'shared_plugin_model' | |||
|
35 | assert_equal SharedPluginModel.report_location, 'SharedPluginModel (from beta_plugin)' | |||
|
36 | end | |||
|
37 | end No newline at end of file |
@@ -0,0 +1,11 | |||||
|
1 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
2 | ||||
|
3 | class PluginsTest < Test::Unit::TestCase | |||
|
4 | ||||
|
5 | def test_should_allow_access_to_plugins_by_strings_or_symbols | |||
|
6 | p = Engines.plugins["alpha_plugin"] | |||
|
7 | q = Engines.plugins[:alpha_plugin] | |||
|
8 | assert_kind_of Engines::Plugin, p | |||
|
9 | assert_equal p, q | |||
|
10 | end | |||
|
11 | end No newline at end of file |
@@ -0,0 +1,7 | |||||
|
1 | require File.join(File.dirname(__FILE__), *%w[.. .. test_helper]) | |||
|
2 | ||||
|
3 | class OverrideTest < ActiveSupport::TestCase | |||
|
4 | def test_overrides_from_the_application_should_work | |||
|
5 | assert true, "overriding plugin tests from the application should work" | |||
|
6 | end | |||
|
7 | end No newline at end of file |
@@ -0,0 +1,19 | |||||
|
1 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
2 | ||||
|
3 | class TestingTest < Test::Unit::TestCase | |||
|
4 | def setup | |||
|
5 | Engines::Testing.set_fixture_path | |||
|
6 | @filename = File.join(Engines::Testing.temporary_fixtures_directory, 'testing_fixtures.yml') | |||
|
7 | File.delete(@filename) if File.exists?(@filename) | |||
|
8 | end | |||
|
9 | ||||
|
10 | def teardown | |||
|
11 | File.delete(@filename) if File.exists?(@filename) | |||
|
12 | end | |||
|
13 | ||||
|
14 | def test_should_copy_fixtures_files_to_tmp_directory | |||
|
15 | assert !File.exists?(@filename) | |||
|
16 | Engines::Testing.setup_plugin_fixtures | |||
|
17 | assert File.exists?(@filename) | |||
|
18 | end | |||
|
19 | end No newline at end of file |
@@ -0,0 +1,21 | |||||
|
1 | module PrependEngineViews | |||
|
2 | def self.included(base) | |||
|
3 | base.send(:include, InstanceMethods) | |||
|
4 | base.class_eval do | |||
|
5 | alias_method_chain :add_engine_view_paths, :prepend | |||
|
6 | end | |||
|
7 | end | |||
|
8 | ||||
|
9 | module InstanceMethods | |||
|
10 | # Patch Rails so engine's views are prepended to the view_path, | |||
|
11 | # thereby letting plugins override application views | |||
|
12 | def add_engine_view_paths_with_prepend | |||
|
13 | paths = ActionView::PathSet.new(engines.collect(&:view_path)) | |||
|
14 | ActionController::Base.view_paths.unshift(*paths) | |||
|
15 | ActionMailer::Base.view_paths.unshift(*paths) if configuration.frameworks.include?(:action_mailer) | |||
|
16 | end | |||
|
17 | end | |||
|
18 | end | |||
|
19 | ||||
|
20 | Rails::Plugin::Loader.send :include, PrependEngineViews | |||
|
21 |
@@ -20,12 +20,7 require 'cgi' | |||||
20 |
|
20 | |||
21 | class ApplicationController < ActionController::Base |
|
21 | class ApplicationController < ActionController::Base | |
22 | include Redmine::I18n |
|
22 | include Redmine::I18n | |
23 |
|
23 | |||
24 | # In case the cookie store secret changes |
|
|||
25 | rescue_from CGI::Session::CookieStore::TamperedWithCookie do |exception| |
|
|||
26 | render :text => 'Your session was invalid and has been reset. Please, reload this page.', :status => 500 |
|
|||
27 | end |
|
|||
28 |
|
||||
29 | layout 'base' |
|
24 | layout 'base' | |
30 |
|
25 | |||
31 | before_filter :user_setup, :check_if_login_required, :set_localization |
|
26 | before_filter :user_setup, :check_if_login_required, :set_localization |
@@ -259,7 +259,7 private | |||||
259 |
|
259 | |||
260 | def graph_commits_per_author(repository) |
|
260 | def graph_commits_per_author(repository) | |
261 | commits_by_author = repository.changesets.count(:all, :group => :committer) |
|
261 | commits_by_author = repository.changesets.count(:all, :group => :committer) | |
262 | commits_by_author.sort! {|x, y| x.last <=> y.last} |
|
262 | commits_by_author.to_a.sort! {|x, y| x.last <=> y.last} | |
263 |
|
263 | |||
264 | changes_by_author = repository.changes.count(:all, :group => :committer) |
|
264 | changes_by_author = repository.changes.count(:all, :group => :committer) | |
265 | h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o} |
|
265 | h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o} |
@@ -16,6 +16,7 | |||||
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class Mailer < ActionMailer::Base |
|
18 | class Mailer < ActionMailer::Base | |
|
19 | layout 'mailer' | |||
19 | helper :application |
|
20 | helper :application | |
20 | helper :issues |
|
21 | helper :issues | |
21 | helper :custom_fields |
|
22 | helper :custom_fields | |
@@ -45,6 +46,7 class Mailer < ActionMailer::Base | |||||
45 | subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}" |
|
46 | subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}" | |
46 | body :issue => issue, |
|
47 | body :issue => issue, | |
47 | :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue) |
|
48 | :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue) | |
|
49 | render_multipart('issue_add', body) | |||
48 | end |
|
50 | end | |
49 |
|
51 | |||
50 | # Builds a tmail object used to email recipients of the edited issue. |
|
52 | # Builds a tmail object used to email recipients of the edited issue. | |
@@ -71,6 +73,8 class Mailer < ActionMailer::Base | |||||
71 | body :issue => issue, |
|
73 | body :issue => issue, | |
72 | :journal => journal, |
|
74 | :journal => journal, | |
73 | :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue) |
|
75 | :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue) | |
|
76 | ||||
|
77 | render_multipart('issue_edit', body) | |||
74 | end |
|
78 | end | |
75 |
|
79 | |||
76 | def reminder(user, issues, days) |
|
80 | def reminder(user, issues, days) | |
@@ -80,6 +84,7 class Mailer < ActionMailer::Base | |||||
80 | body :issues => issues, |
|
84 | body :issues => issues, | |
81 | :days => days, |
|
85 | :days => days, | |
82 | :issues_url => url_for(:controller => 'issues', :action => 'index', :set_filter => 1, :assigned_to_id => user.id, :sort_key => 'due_date', :sort_order => 'asc') |
|
86 | :issues_url => url_for(:controller => 'issues', :action => 'index', :set_filter => 1, :assigned_to_id => user.id, :sort_key => 'due_date', :sort_order => 'asc') | |
|
87 | render_multipart('reminder', body) | |||
83 | end |
|
88 | end | |
84 |
|
89 | |||
85 | # Builds a tmail object used to email users belonging to the added document's project. |
|
90 | # Builds a tmail object used to email users belonging to the added document's project. | |
@@ -93,6 +98,7 class Mailer < ActionMailer::Base | |||||
93 | subject "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}" |
|
98 | subject "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}" | |
94 | body :document => document, |
|
99 | body :document => document, | |
95 | :document_url => url_for(:controller => 'documents', :action => 'show', :id => document) |
|
100 | :document_url => url_for(:controller => 'documents', :action => 'show', :id => document) | |
|
101 | render_multipart('document_added', body) | |||
96 | end |
|
102 | end | |
97 |
|
103 | |||
98 | # Builds a tmail object used to email recipients of a project when an attachements are added. |
|
104 | # Builds a tmail object used to email recipients of a project when an attachements are added. | |
@@ -121,6 +127,7 class Mailer < ActionMailer::Base | |||||
121 | body :attachments => attachments, |
|
127 | body :attachments => attachments, | |
122 | :added_to => added_to, |
|
128 | :added_to => added_to, | |
123 | :added_to_url => added_to_url |
|
129 | :added_to_url => added_to_url | |
|
130 | render_multipart('attachments_added', body) | |||
124 | end |
|
131 | end | |
125 |
|
132 | |||
126 | # Builds a tmail object used to email recipients of a news' project when a news item is added. |
|
133 | # Builds a tmail object used to email recipients of a news' project when a news item is added. | |
@@ -135,6 +142,7 class Mailer < ActionMailer::Base | |||||
135 | subject "[#{news.project.name}] #{l(:label_news)}: #{news.title}" |
|
142 | subject "[#{news.project.name}] #{l(:label_news)}: #{news.title}" | |
136 | body :news => news, |
|
143 | body :news => news, | |
137 | :news_url => url_for(:controller => 'news', :action => 'show', :id => news) |
|
144 | :news_url => url_for(:controller => 'news', :action => 'show', :id => news) | |
|
145 | render_multipart('news_added', body) | |||
138 | end |
|
146 | end | |
139 |
|
147 | |||
140 | # Builds a tmail object used to email the specified recipients of the specified message that was posted. |
|
148 | # Builds a tmail object used to email the specified recipients of the specified message that was posted. | |
@@ -151,6 +159,7 class Mailer < ActionMailer::Base | |||||
151 | subject "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}" |
|
159 | subject "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}" | |
152 | body :message => message, |
|
160 | body :message => message, | |
153 | :message_url => url_for(:controller => 'messages', :action => 'show', :board_id => message.board_id, :id => message.root) |
|
161 | :message_url => url_for(:controller => 'messages', :action => 'show', :board_id => message.board_id, :id => message.root) | |
|
162 | render_multipart('message_posted', body) | |||
154 | end |
|
163 | end | |
155 |
|
164 | |||
156 | # Builds a tmail object used to email the recipients of a project of the specified wiki content was added. |
|
165 | # Builds a tmail object used to email the recipients of a project of the specified wiki content was added. | |
@@ -167,6 +176,7 class Mailer < ActionMailer::Base | |||||
167 | subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :page => wiki_content.page.pretty_title)}" |
|
176 | subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :page => wiki_content.page.pretty_title)}" | |
168 | body :wiki_content => wiki_content, |
|
177 | body :wiki_content => wiki_content, | |
169 | :wiki_content_url => url_for(:controller => 'wiki', :action => 'index', :id => wiki_content.project, :page => wiki_content.page.title) |
|
178 | :wiki_content_url => url_for(:controller => 'wiki', :action => 'index', :id => wiki_content.project, :page => wiki_content.page.title) | |
|
179 | render_multipart('wiki_content_added', body) | |||
170 | end |
|
180 | end | |
171 |
|
181 | |||
172 | # Builds a tmail object used to email the recipients of a project of the specified wiki content was updated. |
|
182 | # Builds a tmail object used to email the recipients of a project of the specified wiki content was updated. | |
@@ -184,6 +194,7 class Mailer < ActionMailer::Base | |||||
184 | body :wiki_content => wiki_content, |
|
194 | body :wiki_content => wiki_content, | |
185 | :wiki_content_url => url_for(:controller => 'wiki', :action => 'index', :id => wiki_content.project, :page => wiki_content.page.title), |
|
195 | :wiki_content_url => url_for(:controller => 'wiki', :action => 'index', :id => wiki_content.project, :page => wiki_content.page.title), | |
186 | :wiki_diff_url => url_for(:controller => 'wiki', :action => 'diff', :id => wiki_content.project, :page => wiki_content.page.title, :version => wiki_content.version) |
|
196 | :wiki_diff_url => url_for(:controller => 'wiki', :action => 'diff', :id => wiki_content.project, :page => wiki_content.page.title, :version => wiki_content.version) | |
|
197 | render_multipart('wiki_content_updated', body) | |||
187 | end |
|
198 | end | |
188 |
|
199 | |||
189 | # Builds a tmail object used to email the specified user their account information. |
|
200 | # Builds a tmail object used to email the specified user their account information. | |
@@ -198,6 +209,7 class Mailer < ActionMailer::Base | |||||
198 | body :user => user, |
|
209 | body :user => user, | |
199 | :password => password, |
|
210 | :password => password, | |
200 | :login_url => url_for(:controller => 'account', :action => 'login') |
|
211 | :login_url => url_for(:controller => 'account', :action => 'login') | |
|
212 | render_multipart('account_information', body) | |||
201 | end |
|
213 | end | |
202 |
|
214 | |||
203 | # Builds a tmail object used to email all active administrators of an account activation request. |
|
215 | # Builds a tmail object used to email all active administrators of an account activation request. | |
@@ -211,6 +223,7 class Mailer < ActionMailer::Base | |||||
211 | subject l(:mail_subject_account_activation_request, Setting.app_title) |
|
223 | subject l(:mail_subject_account_activation_request, Setting.app_title) | |
212 | body :user => user, |
|
224 | body :user => user, | |
213 | :url => url_for(:controller => 'users', :action => 'index', :status => User::STATUS_REGISTERED, :sort_key => 'created_on', :sort_order => 'desc') |
|
225 | :url => url_for(:controller => 'users', :action => 'index', :status => User::STATUS_REGISTERED, :sort_key => 'created_on', :sort_order => 'desc') | |
|
226 | render_multipart('account_activation_request', body) | |||
214 | end |
|
227 | end | |
215 |
|
228 | |||
216 | # Builds a tmail object used to email the specified user that their account was activated by an administrator. |
|
229 | # Builds a tmail object used to email the specified user that their account was activated by an administrator. | |
@@ -224,6 +237,7 class Mailer < ActionMailer::Base | |||||
224 | subject l(:mail_subject_register, Setting.app_title) |
|
237 | subject l(:mail_subject_register, Setting.app_title) | |
225 | body :user => user, |
|
238 | body :user => user, | |
226 | :login_url => url_for(:controller => 'account', :action => 'login') |
|
239 | :login_url => url_for(:controller => 'account', :action => 'login') | |
|
240 | render_multipart('account_activated', body) | |||
227 | end |
|
241 | end | |
228 |
|
242 | |||
229 | def lost_password(token) |
|
243 | def lost_password(token) | |
@@ -232,6 +246,7 class Mailer < ActionMailer::Base | |||||
232 | subject l(:mail_subject_lost_password, Setting.app_title) |
|
246 | subject l(:mail_subject_lost_password, Setting.app_title) | |
233 | body :token => token, |
|
247 | body :token => token, | |
234 | :url => url_for(:controller => 'account', :action => 'lost_password', :token => token.value) |
|
248 | :url => url_for(:controller => 'account', :action => 'lost_password', :token => token.value) | |
|
249 | render_multipart('lost_password', body) | |||
235 | end |
|
250 | end | |
236 |
|
251 | |||
237 | def register(token) |
|
252 | def register(token) | |
@@ -240,6 +255,7 class Mailer < ActionMailer::Base | |||||
240 | subject l(:mail_subject_register, Setting.app_title) |
|
255 | subject l(:mail_subject_register, Setting.app_title) | |
241 | body :token => token, |
|
256 | body :token => token, | |
242 | :url => url_for(:controller => 'account', :action => 'activate', :token => token.value) |
|
257 | :url => url_for(:controller => 'account', :action => 'activate', :token => token.value) | |
|
258 | render_multipart('register', body) | |||
243 | end |
|
259 | end | |
244 |
|
260 | |||
245 | def test(user) |
|
261 | def test(user) | |
@@ -247,6 +263,7 class Mailer < ActionMailer::Base | |||||
247 | recipients user.mail |
|
263 | recipients user.mail | |
248 | subject 'Redmine test' |
|
264 | subject 'Redmine test' | |
249 | body :url => url_for(:controller => 'welcome') |
|
265 | body :url => url_for(:controller => 'welcome') | |
|
266 | render_multipart('test', body) | |||
250 | end |
|
267 | end | |
251 |
|
268 | |||
252 | # Overrides default deliver! method to prevent from sending an email |
|
269 | # Overrides default deliver! method to prevent from sending an email | |
@@ -327,26 +344,17 class Mailer < ActionMailer::Base | |||||
327 | super |
|
344 | super | |
328 | end |
|
345 | end | |
329 |
|
346 | |||
330 | # Renders a message with the corresponding layout |
|
347 | # Rails 2.3 has problems rendering implicit multipart messages with | |
331 | def render_message(method_name, body) |
|
348 | # layouts so this method will wrap an multipart messages with | |
332 | layout = method_name.to_s.match(%r{text\.html\.(rhtml|rxml)}) ? 'layout.text.html.rhtml' : 'layout.text.plain.rhtml' |
|
349 | # explicit parts. | |
333 | body[:content_for_layout] = render(:file => method_name, :body => body) |
|
350 | # | |
334 | ActionView::Base.new(template_root, body, self).render(:file => "mailer/#{layout}", :use_full_path => true) |
|
351 | # https://rails.lighthouseapp.com/projects/8994/tickets/2338-actionmailer-mailer-views-and-content-type | |
335 | end |
|
352 | # https://rails.lighthouseapp.com/projects/8994/tickets/1799-actionmailer-doesnt-set-template_format-when-rendering-layouts | |
336 |
|
353 | |||
337 | # for the case of plain text only |
|
354 | def render_multipart(method_name, body) | |
338 | def body(*params) |
|
355 | content_type "multipart/alternative" | |
339 | value = super(*params) |
|
356 | part :content_type => "text/plain", :body => render(:file => "#{method_name}.text.plain.rhtml", :body => body, :layout => 'mailer.text.plain.erb') | |
340 | if Setting.plain_text_mail? |
|
357 | part :content_type => "text/html", :body => render_message("#{method_name}.text.html.rhtml", body) unless Setting.plain_text_mail? | |
341 | templates = Dir.glob("#{template_path}/#{@template}.text.plain.{rhtml,erb}") |
|
|||
342 | unless String === @body or templates.empty? |
|
|||
343 | template = File.basename(templates.first) |
|
|||
344 | @body[:content_for_layout] = render(:file => template, :body => @body) |
|
|||
345 | @body = ActionView::Base.new(template_root, @body, self).render(:file => "mailer/layout.text.plain.rhtml", :use_full_path => true) |
|
|||
346 | return @body |
|
|||
347 | end |
|
|||
348 | end |
|
|||
349 | return value |
|
|||
350 | end |
|
358 | end | |
351 |
|
359 | |||
352 | # Makes partial rendering work with Rails 1.2 (retro-compatibility) |
|
360 | # Makes partial rendering work with Rails 1.2 (retro-compatibility) |
1 | NO CONTENT: file renamed from app/views/mailer/layout.text.html.rhtml to app/views/layouts/mailer.text.html.erb |
|
NO CONTENT: file renamed from app/views/mailer/layout.text.html.rhtml to app/views/layouts/mailer.text.html.erb |
1 | NO CONTENT: file renamed from app/views/mailer/layout.text.plain.rhtml to app/views/layouts/mailer.text.plain.erb |
|
NO CONTENT: file renamed from app/views/mailer/layout.text.plain.rhtml to app/views/layouts/mailer.text.plain.erb |
@@ -2,7 +2,9 | |||||
2 |
|
2 | |||
3 | <div class="box tabular settings"> |
|
3 | <div class="box tabular settings"> | |
4 | <p><label><%= l(:setting_login_required) %></label> |
|
4 | <p><label><%= l(:setting_login_required) %></label> | |
5 | <%= check_box_tag 'settings[login_required]', 1, Setting.login_required? %><%= hidden_field_tag 'settings[login_required]', 0 %></p> |
|
5 | <%= hidden_field_tag 'settings[login_required]', 0 %> | |
|
6 | <%= check_box_tag 'settings[login_required]', 1, Setting.login_required? %> | |||
|
7 | </p> | |||
6 |
|
8 | |||
7 | <p><label><%= l(:setting_autologin) %></label> |
|
9 | <p><label><%= l(:setting_autologin) %></label> | |
8 | <%= select_tag 'settings[autologin]', options_for_select( [[l(:label_disabled), "0"]] + [1, 7, 30, 365].collect{|days| [l('datetime.distance_in_words.x_days', :count => days), days.to_s]}, Setting.autologin) %></p> |
|
10 | <%= select_tag 'settings[autologin]', options_for_select( [[l(:label_disabled), "0"]] + [1, 7, 30, 365].collect{|days| [l('datetime.distance_in_words.x_days', :count => days), days.to_s]}, Setting.autologin) %></p> | |
@@ -19,10 +21,14 | |||||
19 | <%= text_field_tag 'settings[password_min_length]', Setting.password_min_length, :size => 6 %></p> |
|
21 | <%= text_field_tag 'settings[password_min_length]', Setting.password_min_length, :size => 6 %></p> | |
20 |
|
22 | |||
21 | <p><label><%= l(:label_password_lost) %></label> |
|
23 | <p><label><%= l(:label_password_lost) %></label> | |
22 | <%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %></p> |
|
24 | <%= hidden_field_tag 'settings[lost_password]', 0 %> | |
|
25 | <%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %> | |||
|
26 | </p> | |||
23 |
|
27 | |||
24 | <p><label><%= l(:setting_openid) %></label> |
|
28 | <p><label><%= l(:setting_openid) %></label> | |
25 | <%= check_box_tag 'settings[openid]', 1, Setting.openid?, :disabled => !Object.const_defined?(:OpenID) %><%= hidden_field_tag 'settings[openid]', 0 %></p> |
|
29 | <%= hidden_field_tag 'settings[openid]', 0 %> | |
|
30 | <%= check_box_tag 'settings[openid]', 1, Setting.openid?, :disabled => !Object.const_defined?(:OpenID) %> | |||
|
31 | </p> | |||
26 | </div> |
|
32 | </div> | |
27 |
|
33 | |||
28 | <div style="float:right;"> |
|
34 | <div style="float:right;"> |
@@ -17,7 +17,9 | |||||
17 | <%= select_tag 'settings[user_format]', options_for_select( @options[:user_format], Setting.user_format.to_s ) %></p> |
|
17 | <%= select_tag 'settings[user_format]', options_for_select( @options[:user_format], Setting.user_format.to_s ) %></p> | |
18 |
|
18 | |||
19 | <p><label><%= l(:setting_gravatar_enabled) %></label> |
|
19 | <p><label><%= l(:setting_gravatar_enabled) %></label> | |
20 | <%= check_box_tag 'settings[gravatar_enabled]', 1, Setting.gravatar_enabled? %><%= hidden_field_tag 'settings[gravatar_enabled]', 0 %></p> |
|
20 | <%= hidden_field_tag 'settings[gravatar_enabled]', 0 %> | |
|
21 | <%= check_box_tag 'settings[gravatar_enabled]', 1, Setting.gravatar_enabled? %> | |||
|
22 | </p> | |||
21 | </div> |
|
23 | </div> | |
22 |
|
24 | |||
23 | <%= submit_tag l(:button_save) %> |
|
25 | <%= submit_tag l(:button_save) %> |
@@ -2,10 +2,14 | |||||
2 |
|
2 | |||
3 | <div class="box tabular settings"> |
|
3 | <div class="box tabular settings"> | |
4 | <p><label><%= l(:setting_cross_project_issue_relations) %></label> |
|
4 | <p><label><%= l(:setting_cross_project_issue_relations) %></label> | |
5 | <%= check_box_tag 'settings[cross_project_issue_relations]', 1, Setting.cross_project_issue_relations? %><%= hidden_field_tag 'settings[cross_project_issue_relations]', 0 %></p> |
|
5 | <%= hidden_field_tag 'settings[cross_project_issue_relations]', 0 %> | |
|
6 | <%= check_box_tag 'settings[cross_project_issue_relations]', 1, Setting.cross_project_issue_relations? %> | |||
|
7 | </p> | |||
6 |
|
8 | |||
7 | <p><label><%= l(:setting_display_subprojects_issues) %></label> |
|
9 | <p><label><%= l(:setting_display_subprojects_issues) %></label> | |
8 | <%= check_box_tag 'settings[display_subprojects_issues]', 1, Setting.display_subprojects_issues? %><%= hidden_field_tag 'settings[display_subprojects_issues]', 0 %></p> |
|
10 | <%= hidden_field_tag 'settings[display_subprojects_issues]', 0 %> | |
|
11 | <%= check_box_tag 'settings[display_subprojects_issues]', 1, Setting.display_subprojects_issues? %> | |||
|
12 | </p> | |||
9 |
|
13 | |||
10 | <p><label><%= l(:setting_issues_export_limit) %></label> |
|
14 | <p><label><%= l(:setting_issues_export_limit) %></label> | |
11 | <%= text_field_tag 'settings[issues_export_limit]', Setting.issues_export_limit, :size => 6 %></p> |
|
15 | <%= text_field_tag 'settings[issues_export_limit]', Setting.issues_export_limit, :size => 6 %></p> |
@@ -2,9 +2,10 | |||||
2 |
|
2 | |||
3 | <div class="box tabular settings"> |
|
3 | <div class="box tabular settings"> | |
4 | <p><label><%= l(:setting_mail_handler_api_enabled) %></label> |
|
4 | <p><label><%= l(:setting_mail_handler_api_enabled) %></label> | |
|
5 | <%= hidden_field_tag 'settings[mail_handler_api_enabled]', 0 %> | |||
5 | <%= check_box_tag 'settings[mail_handler_api_enabled]', 1, Setting.mail_handler_api_enabled?, |
|
6 | <%= check_box_tag 'settings[mail_handler_api_enabled]', 1, Setting.mail_handler_api_enabled?, | |
6 | :onclick => "if (this.checked) { Form.Element.enable('settings_mail_handler_api_key'); } else { Form.Element.disable('settings_mail_handler_api_key'); }" %> |
|
7 | :onclick => "if (this.checked) { Form.Element.enable('settings_mail_handler_api_key'); } else { Form.Element.disable('settings_mail_handler_api_key'); }" %> | |
7 | <%= hidden_field_tag 'settings[mail_handler_api_enabled]', 0 %></p> |
|
8 | </p> | |
8 |
|
9 | |||
9 | <p><label><%= l(:setting_mail_handler_api_key) %></label> |
|
10 | <p><label><%= l(:setting_mail_handler_api_key) %></label> | |
10 | <%= text_field_tag 'settings[mail_handler_api_key]', Setting.mail_handler_api_key, |
|
11 | <%= text_field_tag 'settings[mail_handler_api_key]', Setting.mail_handler_api_key, |
@@ -6,12 +6,14 | |||||
6 | <%= text_field_tag 'settings[mail_from]', Setting.mail_from, :size => 60 %></p> |
|
6 | <%= text_field_tag 'settings[mail_from]', Setting.mail_from, :size => 60 %></p> | |
7 |
|
7 | |||
8 | <p><label><%= l(:setting_bcc_recipients) %></label> |
|
8 | <p><label><%= l(:setting_bcc_recipients) %></label> | |
|
9 | <%= hidden_field_tag 'settings[bcc_recipients]', 0 %> | |||
9 | <%= check_box_tag 'settings[bcc_recipients]', 1, Setting.bcc_recipients? %> |
|
10 | <%= check_box_tag 'settings[bcc_recipients]', 1, Setting.bcc_recipients? %> | |
10 | <%= hidden_field_tag 'settings[bcc_recipients]', 0 %></p> |
|
11 | </p> | |
11 |
|
12 | |||
12 | <p><label><%= l(:setting_plain_text_mail) %></label> |
|
13 | <p><label><%= l(:setting_plain_text_mail) %></label> | |
|
14 | <%= hidden_field_tag 'settings[plain_text_mail]', 0 %> | |||
13 | <%= check_box_tag 'settings[plain_text_mail]', 1, Setting.plain_text_mail? %> |
|
15 | <%= check_box_tag 'settings[plain_text_mail]', 1, Setting.plain_text_mail? %> | |
14 | <%= hidden_field_tag 'settings[plain_text_mail]', 0 %></p> |
|
16 | </p> | |
15 | </div> |
|
17 | </div> | |
16 |
|
18 | |||
17 | <fieldset class="box" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend> |
|
19 | <fieldset class="box" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend> |
@@ -2,10 +2,14 | |||||
2 |
|
2 | |||
3 | <div class="box tabular settings"> |
|
3 | <div class="box tabular settings"> | |
4 | <p><label><%= l(:setting_default_projects_public) %></label> |
|
4 | <p><label><%= l(:setting_default_projects_public) %></label> | |
5 | <%= check_box_tag 'settings[default_projects_public]', 1, Setting.default_projects_public? %><%= hidden_field_tag 'settings[default_projects_public]', 0 %></p> |
|
5 | <%= hidden_field_tag 'settings[default_projects_public]', 0 %> | |
|
6 | <%= check_box_tag 'settings[default_projects_public]', 1, Setting.default_projects_public? %> | |||
|
7 | </p> | |||
6 |
|
8 | |||
7 | <p><label><%= l(:setting_sequential_project_identifiers) %></label> |
|
9 | <p><label><%= l(:setting_sequential_project_identifiers) %></label> | |
8 | <%= check_box_tag 'settings[sequential_project_identifiers]', 1, Setting.sequential_project_identifiers? %><%= hidden_field_tag 'settings[sequential_project_identifiers]', 0 %></p> |
|
10 | <%= hidden_field_tag 'settings[sequential_project_identifiers]', 0 %> | |
|
11 | <%= check_box_tag 'settings[sequential_project_identifiers]', 1, Setting.sequential_project_identifiers? %> | |||
|
12 | </p> | |||
9 |
|
13 | |||
10 | <p><label><%= l(:setting_new_project_user_role_id) %></label> |
|
14 | <p><label><%= l(:setting_new_project_user_role_id) %></label> | |
11 | <%= select_tag('settings[new_project_user_role_id]', options_for_select([["--- #{l(:actionview_instancetag_blank_option)} ---", '']] + Role.find_all_givable.collect {|r| [r.name, r.id]}, Setting.new_project_user_role_id.to_i)) %></p> |
|
15 | <%= select_tag('settings[new_project_user_role_id]', options_for_select([["--- #{l(:actionview_instancetag_blank_option)} ---", '']] + Role.find_all_givable.collect {|r| [r.name, r.id]}, Setting.new_project_user_role_id.to_i)) %></p> |
@@ -2,10 +2,14 | |||||
2 |
|
2 | |||
3 | <div class="box tabular settings"> |
|
3 | <div class="box tabular settings"> | |
4 | <p><label><%= l(:setting_autofetch_changesets) %></label> |
|
4 | <p><label><%= l(:setting_autofetch_changesets) %></label> | |
5 | <%= check_box_tag 'settings[autofetch_changesets]', 1, Setting.autofetch_changesets? %><%= hidden_field_tag 'settings[autofetch_changesets]', 0 %></p> |
|
5 | <%= hidden_field_tag 'settings[autofetch_changesets]', 0 %> | |
|
6 | <%= check_box_tag 'settings[autofetch_changesets]', 1, Setting.autofetch_changesets? %> | |||
|
7 | </p> | |||
6 |
|
8 | |||
7 | <p><label><%= l(:setting_sys_api_enabled) %></label> |
|
9 | <p><label><%= l(:setting_sys_api_enabled) %></label> | |
8 | <%= check_box_tag 'settings[sys_api_enabled]', 1, Setting.sys_api_enabled? %><%= hidden_field_tag 'settings[sys_api_enabled]', 0 %></p> |
|
10 | <%= hidden_field_tag 'settings[sys_api_enabled]', 0 %> | |
|
11 | <%= check_box_tag 'settings[sys_api_enabled]', 1, Setting.sys_api_enabled? %> | |||
|
12 | </p> | |||
9 |
|
13 | |||
10 | <p><label><%= l(:setting_enabled_scm) %></label> |
|
14 | <p><label><%= l(:setting_enabled_scm) %></label> | |
11 | <% REDMINE_SUPPORTED_SCM.each do |scm| -%> |
|
15 | <% REDMINE_SUPPORTED_SCM.each do |scm| -%> |
@@ -1,7 +1,7 | |||||
1 | # Don't change this file! |
|
1 | # Don't change this file! | |
2 | # Configure your app in config/environment.rb and config/environments/*.rb |
|
2 | # Configure your app in config/environment.rb and config/environments/*.rb | |
3 |
|
3 | |||
4 |
RAILS_ROOT = |
|
4 | RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) | |
5 |
|
5 | |||
6 | module Rails |
|
6 | module Rails | |
7 | class << self |
|
7 | class << self | |
@@ -44,6 +44,7 module Rails | |||||
44 | def load_initializer |
|
44 | def load_initializer | |
45 | require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" |
|
45 | require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" | |
46 | Rails::Initializer.run(:install_gem_spec_stubs) |
|
46 | Rails::Initializer.run(:install_gem_spec_stubs) | |
|
47 | Rails::GemDependency.add_frozen_gem_path | |||
47 | end |
|
48 | end | |
48 | end |
|
49 | end | |
49 |
|
50 | |||
@@ -81,8 +82,8 module Rails | |||||
81 | end |
|
82 | end | |
82 |
|
83 | |||
83 | def load_rubygems |
|
84 | def load_rubygems | |
|
85 | min_version = '1.3.2' | |||
84 | require 'rubygems' |
|
86 | require 'rubygems' | |
85 | min_version = '1.3.1' |
|
|||
86 | unless rubygems_version >= min_version |
|
87 | unless rubygems_version >= min_version | |
87 | $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.) |
|
88 | $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.) | |
88 | exit 1 |
|
89 | exit 1 |
@@ -5,7 +5,7 | |||||
5 | # ENV['RAILS_ENV'] ||= 'production' |
|
5 | # ENV['RAILS_ENV'] ||= 'production' | |
6 |
|
6 | |||
7 | # Specifies gem version of Rails to use when vendor/rails is not present |
|
7 | # Specifies gem version of Rails to use when vendor/rails is not present | |
8 |
RAILS_GEM_VERSION = '2. |
|
8 | RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION | |
9 |
|
9 | |||
10 | # Bootstrap the Rails environment, frameworks, and default configuration |
|
10 | # Bootstrap the Rails environment, frameworks, and default configuration | |
11 | require File.join(File.dirname(__FILE__), 'boot') |
|
11 | require File.join(File.dirname(__FILE__), 'boot') |
@@ -33,7 +33,7 module ActiveRecord | |||||
33 | end |
|
33 | end | |
34 | else |
|
34 | else | |
35 | attr_name = @base.class.human_attribute_name(attr) |
|
35 | attr_name = @base.class.human_attribute_name(attr) | |
36 | full_messages << attr_name + ' ' + message |
|
36 | full_messages << attr_name + ' ' + message.to_s | |
37 | end |
|
37 | end | |
38 | end |
|
38 | end | |
39 | end |
|
39 | end |
@@ -59,6 +59,22 bg: | |||||
59 | over_x_years: |
|
59 | over_x_years: | |
60 | one: "over 1 year" |
|
60 | one: "over 1 year" | |
61 | other: "over {{count}} years" |
|
61 | other: "over {{count}} years" | |
|
62 | ||||
|
63 | number: | |||
|
64 | human: | |||
|
65 | format: | |||
|
66 | precision: 1 | |||
|
67 | delimiter: "" | |||
|
68 | storage_units: | |||
|
69 | format: "%n %u" | |||
|
70 | units: | |||
|
71 | kb: KB | |||
|
72 | tb: TB | |||
|
73 | gb: GB | |||
|
74 | byte: | |||
|
75 | one: Byte | |||
|
76 | other: Bytes | |||
|
77 | mb: 'MB' | |||
62 |
|
78 | |||
63 | # Used in array.to_sentence. |
|
79 | # Used in array.to_sentence. | |
64 | support: |
|
80 | support: |
@@ -83,9 +83,16 bs: | |||||
83 | format: |
|
83 | format: | |
84 | delimiter: "" |
|
84 | delimiter: "" | |
85 | precision: 1 |
|
85 | precision: 1 | |
86 |
|
86 | storage_units: | ||
87 |
|
87 | format: "%n %u" | ||
88 |
|
88 | units: | ||
|
89 | byte: | |||
|
90 | one: "Byte" | |||
|
91 | other: "Bytes" | |||
|
92 | kb: "KB" | |||
|
93 | mb: "MB" | |||
|
94 | gb: "GB" | |||
|
95 | tb: "TB" | |||
89 |
|
96 | |||
90 | # Used in array.to_sentence. |
|
97 | # Used in array.to_sentence. | |
91 | support: |
|
98 | support: |
@@ -59,6 +59,22 ca: | |||||
59 | over_x_years: |
|
59 | over_x_years: | |
60 | one: "més d'un any" |
|
60 | one: "més d'un any" | |
61 | other: "més de {{count}} anys" |
|
61 | other: "més de {{count}} anys" | |
|
62 | ||||
|
63 | number: | |||
|
64 | human: | |||
|
65 | format: | |||
|
66 | delimiter: "" | |||
|
67 | precision: 1 | |||
|
68 | storage_units: | |||
|
69 | format: "%n %u" | |||
|
70 | units: | |||
|
71 | byte: | |||
|
72 | one: "Byte" | |||
|
73 | other: "Bytes" | |||
|
74 | kb: "KB" | |||
|
75 | mb: "MB" | |||
|
76 | gb: "GB" | |||
|
77 | tb: "TB" | |||
62 |
|
78 | |||
63 | # Used in array.to_sentence. |
|
79 | # Used in array.to_sentence. | |
64 | support: |
|
80 | support: |
@@ -59,6 +59,22 cs: | |||||
59 | over_x_years: |
|
59 | over_x_years: | |
60 | one: "více než 1 rok" |
|
60 | one: "více než 1 rok" | |
61 | other: "více než {{count}} roky" |
|
61 | other: "více než {{count}} roky" | |
|
62 | ||||
|
63 | number: | |||
|
64 | human: | |||
|
65 | format: | |||
|
66 | precision: 1 | |||
|
67 | delimiter: "" | |||
|
68 | storage_units: | |||
|
69 | format: "%n %u" | |||
|
70 | units: | |||
|
71 | kb: KB | |||
|
72 | tb: TB | |||
|
73 | gb: GB | |||
|
74 | byte: | |||
|
75 | one: Byte | |||
|
76 | other: Bytes | |||
|
77 | mb: MB | |||
62 |
|
78 | |||
63 | # Used in array.to_sentence. |
|
79 | # Used in array.to_sentence. | |
64 | support: |
|
80 | support: |
@@ -85,7 +85,16 da: | |||||
85 | # separator: |
|
85 | # separator: | |
86 | delimiter: "" |
|
86 | delimiter: "" | |
87 | precision: 1 |
|
87 | precision: 1 | |
88 |
storage_units: |
|
88 | storage_units: | |
|
89 | format: "%n %u" | |||
|
90 | units: | |||
|
91 | byte: | |||
|
92 | one: "Byte" | |||
|
93 | other: "Bytes" | |||
|
94 | kb: "KB" | |||
|
95 | mb: "MB" | |||
|
96 | gb: "GB" | |||
|
97 | tb: "TB" | |||
89 | percentage: |
|
98 | percentage: | |
90 | format: |
|
99 | format: | |
91 | # separator: |
|
100 | # separator: |
@@ -83,6 +83,16 de: | |||||
83 | format: |
|
83 | format: | |
84 | delimiter: "" |
|
84 | delimiter: "" | |
85 | precision: 1 |
|
85 | precision: 1 | |
|
86 | storage_units: | |||
|
87 | format: "%n %u" | |||
|
88 | units: | |||
|
89 | byte: | |||
|
90 | one: "Byte" | |||
|
91 | other: "Bytes" | |||
|
92 | kb: "KB" | |||
|
93 | mb: "MB" | |||
|
94 | gb: "GB" | |||
|
95 | tb: "TB" | |||
86 |
|
96 | |||
87 | support: |
|
97 | support: | |
88 | array: |
|
98 | array: |
@@ -63,6 +63,22 el: | |||||
63 | one: "πάνω από 1 χρόνο" |
|
63 | one: "πάνω από 1 χρόνο" | |
64 | other: "πάνω από {{count}} χρόνια" |
|
64 | other: "πάνω από {{count}} χρόνια" | |
65 |
|
65 | |||
|
66 | number: | |||
|
67 | human: | |||
|
68 | format: | |||
|
69 | precision: 1 | |||
|
70 | delimiter: "" | |||
|
71 | storage_units: | |||
|
72 | format: "%n %u" | |||
|
73 | units: | |||
|
74 | kb: KB | |||
|
75 | tb: TB | |||
|
76 | gb: GB | |||
|
77 | byte: | |||
|
78 | one: Byte | |||
|
79 | other: Bytes | |||
|
80 | mb: MB | |||
|
81 | ||||
66 | # Used in array.to_sentence. |
|
82 | # Used in array.to_sentence. | |
67 | support: |
|
83 | support: | |
68 | array: |
|
84 | array: |
@@ -59,6 +59,23 en: | |||||
59 | over_x_years: |
|
59 | over_x_years: | |
60 | one: "over 1 year" |
|
60 | one: "over 1 year" | |
61 | other: "over {{count}} years" |
|
61 | other: "over {{count}} years" | |
|
62 | ||||
|
63 | number: | |||
|
64 | human: | |||
|
65 | format: | |||
|
66 | delimiter: "" | |||
|
67 | precision: 1 | |||
|
68 | storage_units: | |||
|
69 | format: "%n %u" | |||
|
70 | units: | |||
|
71 | byte: | |||
|
72 | one: "Byte" | |||
|
73 | other: "Bytes" | |||
|
74 | kb: "KB" | |||
|
75 | mb: "MB" | |||
|
76 | gb: "GB" | |||
|
77 | tb: "TB" | |||
|
78 | ||||
62 |
|
79 | |||
63 | # Used in array.to_sentence. |
|
80 | # Used in array.to_sentence. | |
64 | support: |
|
81 | support: |
@@ -47,6 +47,16 es: | |||||
47 | # separator: |
|
47 | # separator: | |
48 | delimiter: "" |
|
48 | delimiter: "" | |
49 | precision: 1 |
|
49 | precision: 1 | |
|
50 | storage_units: | |||
|
51 | format: "%n %u" | |||
|
52 | units: | |||
|
53 | byte: | |||
|
54 | one: "Byte" | |||
|
55 | other: "Bytes" | |||
|
56 | kb: "KB" | |||
|
57 | mb: "MB" | |||
|
58 | gb: "GB" | |||
|
59 | tb: "TB" | |||
50 |
|
60 | |||
51 | # Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words() |
|
61 | # Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words() | |
52 | datetime: |
|
62 | datetime: |
@@ -61,7 +61,16 fi: | |||||
61 | format: |
|
61 | format: | |
62 | delimiter: "" |
|
62 | delimiter: "" | |
63 | precision: 1 |
|
63 | precision: 1 | |
64 |
storage_units: |
|
64 | storage_units: | |
|
65 | format: "%n %u" | |||
|
66 | units: | |||
|
67 | byte: | |||
|
68 | one: "Tavua" | |||
|
69 | other: "Tavua" | |||
|
70 | kb: "KB" | |||
|
71 | mb: "MB" | |||
|
72 | gb: "GB" | |||
|
73 | tb: "TB" | |||
65 |
|
74 | |||
66 | datetime: |
|
75 | datetime: | |
67 | distance_in_words: |
|
76 | distance_in_words: |
@@ -84,7 +84,16 fr: | |||||
84 | human: |
|
84 | human: | |
85 | format: |
|
85 | format: | |
86 | precision: 2 |
|
86 | precision: 2 | |
87 |
storage_units: |
|
87 | storage_units: | |
|
88 | format: "%n %u" | |||
|
89 | units: | |||
|
90 | byte: | |||
|
91 | one: "Octet" | |||
|
92 | other: "Octet" | |||
|
93 | kb: "ko" | |||
|
94 | mb: "Mo" | |||
|
95 | gb: "Go" | |||
|
96 | tb: "To" | |||
88 |
|
97 | |||
89 | support: |
|
98 | support: | |
90 | array: |
|
99 | array: |
@@ -33,6 +33,16 gl: | |||||
33 | # separator: |
|
33 | # separator: | |
34 | delimiter: "" |
|
34 | delimiter: "" | |
35 | precision: 1 |
|
35 | precision: 1 | |
|
36 | storage_units: | |||
|
37 | format: "%n %u" | |||
|
38 | units: | |||
|
39 | byte: | |||
|
40 | one: "Byte" | |||
|
41 | other: "Bytes" | |||
|
42 | kb: "KB" | |||
|
43 | mb: "MB" | |||
|
44 | gb: "GB" | |||
|
45 | tb: "TB" | |||
36 |
|
46 | |||
37 |
|
47 | |||
38 | date: |
|
48 | date: |
@@ -76,6 +76,17 he: | |||||
76 | unit: 'שח' |
|
76 | unit: 'שח' | |
77 | precision: 2 |
|
77 | precision: 2 | |
78 | format: '%u %n' |
|
78 | format: '%u %n' | |
|
79 | human: | |||
|
80 | storage_units: | |||
|
81 | format: "%n %u" | |||
|
82 | units: | |||
|
83 | byte: | |||
|
84 | one: "Byte" | |||
|
85 | other: "Bytes" | |||
|
86 | kb: "KB" | |||
|
87 | mb: "MB" | |||
|
88 | gb: "GB" | |||
|
89 | tb: "TB" | |||
79 |
|
90 | |||
80 | support: |
|
91 | support: | |
81 | array: |
|
92 | array: |
@@ -90,7 +90,16 | |||||
90 | format: |
|
90 | format: | |
91 | delimiter: "" |
|
91 | delimiter: "" | |
92 | precision: 1 |
|
92 | precision: 1 | |
93 |
storage_units: |
|
93 | storage_units: | |
|
94 | format: "%n %u" | |||
|
95 | units: | |||
|
96 | byte: | |||
|
97 | one: "bájt" | |||
|
98 | other: "bájt" | |||
|
99 | kb: "KB" | |||
|
100 | mb: "MB" | |||
|
101 | gb: "GB" | |||
|
102 | tb: "TB" | |||
94 |
|
103 | |||
95 | support: |
|
104 | support: | |
96 | array: |
|
105 | array: |
@@ -74,6 +74,17 it: | |||||
74 | unit: '€' |
|
74 | unit: '€' | |
75 | precision: 2 |
|
75 | precision: 2 | |
76 | format: '%n %u' |
|
76 | format: '%n %u' | |
|
77 | human: | |||
|
78 | storage_units: | |||
|
79 | format: "%n %u" | |||
|
80 | units: | |||
|
81 | byte: | |||
|
82 | one: "Byte" | |||
|
83 | other: "Bytes" | |||
|
84 | kb: "KB" | |||
|
85 | mb: "MB" | |||
|
86 | gb: "GB" | |||
|
87 | tb: "TB" | |||
77 |
|
88 | |||
78 | support: |
|
89 | support: | |
79 | array: |
|
90 | array: |
@@ -96,6 +96,16 ja: | |||||
96 | format: |
|
96 | format: | |
97 | delimiter: "" |
|
97 | delimiter: "" | |
98 | precision: 1 |
|
98 | precision: 1 | |
|
99 | storage_units: | |||
|
100 | format: "%n %u" | |||
|
101 | units: | |||
|
102 | byte: | |||
|
103 | one: "Byte" | |||
|
104 | other: "Bytes" | |||
|
105 | kb: "KB" | |||
|
106 | mb: "MB" | |||
|
107 | gb: "GB" | |||
|
108 | tb: "TB" | |||
99 |
|
109 | |||
100 | activerecord: |
|
110 | activerecord: | |
101 | errors: |
|
111 | errors: |
@@ -116,7 +116,16 ko: | |||||
116 | # separator: |
|
116 | # separator: | |
117 | delimiter: "" |
|
117 | delimiter: "" | |
118 | precision: 1 |
|
118 | precision: 1 | |
119 |
storage_units: |
|
119 | storage_units: | |
|
120 | format: "%n %u" | |||
|
121 | units: | |||
|
122 | byte: | |||
|
123 | one: "Byte" | |||
|
124 | other: "Bytes" | |||
|
125 | kb: "KB" | |||
|
126 | mb: "MB" | |||
|
127 | gb: "GB" | |||
|
128 | tb: "TB" | |||
120 |
|
129 | |||
121 | # Used in array.to_sentence. |
|
130 | # Used in array.to_sentence. | |
122 | support: |
|
131 | support: |
@@ -28,7 +28,16 lt: | |||||
28 | format: |
|
28 | format: | |
29 | delimiter: "" |
|
29 | delimiter: "" | |
30 | precision: 1 |
|
30 | precision: 1 | |
31 |
storage_units: |
|
31 | storage_units: | |
|
32 | format: "%n %u" | |||
|
33 | units: | |||
|
34 | byte: | |||
|
35 | one: "baitai" | |||
|
36 | other: "baitai" | |||
|
37 | kb: "KB" | |||
|
38 | mb: "MB" | |||
|
39 | gb: "GB" | |||
|
40 | tb: "TB" | |||
32 |
|
41 | |||
33 | datetime: |
|
42 | datetime: | |
34 | distance_in_words: |
|
43 | distance_in_words: |
@@ -59,6 +59,22 nl: | |||||
59 | over_x_years: |
|
59 | over_x_years: | |
60 | one: "over 1 jaar" |
|
60 | one: "over 1 jaar" | |
61 | other: "over {{count}} jaren" |
|
61 | other: "over {{count}} jaren" | |
|
62 | ||||
|
63 | number: | |||
|
64 | human: | |||
|
65 | format: | |||
|
66 | precision: 1 | |||
|
67 | delimiter: "" | |||
|
68 | storage_units: | |||
|
69 | format: "%n %u" | |||
|
70 | units: | |||
|
71 | kb: KB | |||
|
72 | tb: TB | |||
|
73 | gb: GB | |||
|
74 | byte: | |||
|
75 | one: Byte | |||
|
76 | other: Bytes | |||
|
77 | mb: MB | |||
62 |
|
78 | |||
63 | # Used in array.to_sentence. |
|
79 | # Used in array.to_sentence. | |
64 | support: |
|
80 | support: |
@@ -67,6 +67,18 | |||||
67 | format: |
|
67 | format: | |
68 | delimiter: "" |
|
68 | delimiter: "" | |
69 | precision: 4 |
|
69 | precision: 4 | |
|
70 | human: | |||
|
71 | storage_units: | |||
|
72 | format: "%n %u" | |||
|
73 | units: | |||
|
74 | byte: | |||
|
75 | one: "Byte" | |||
|
76 | other: "Bytes" | |||
|
77 | kb: "KB" | |||
|
78 | mb: "MB" | |||
|
79 | gb: "GB" | |||
|
80 | tb: "TB" | |||
|
81 | ||||
70 | activerecord: |
|
82 | activerecord: | |
71 | errors: |
|
83 | errors: | |
72 | template: |
|
84 | template: |
@@ -21,7 +21,16 pl: | |||||
21 | format: |
|
21 | format: | |
22 | delimiter: "" |
|
22 | delimiter: "" | |
23 | precision: 1 |
|
23 | precision: 1 | |
24 |
storage_units: |
|
24 | storage_units: | |
|
25 | format: "%n %u" | |||
|
26 | units: | |||
|
27 | byte: | |||
|
28 | one: "B" | |||
|
29 | other: "B" | |||
|
30 | kb: "KB" | |||
|
31 | mb: "MB" | |||
|
32 | gb: "GB" | |||
|
33 | tb: "TB" | |||
25 |
|
34 | |||
26 | date: |
|
35 | date: | |
27 | formats: |
|
36 | formats: |
@@ -93,6 +93,16 pt-BR: | |||||
93 | format: |
|
93 | format: | |
94 | precision: 1 |
|
94 | precision: 1 | |
95 | delimiter: '.' |
|
95 | delimiter: '.' | |
|
96 | storage_units: | |||
|
97 | format: "%n %u" | |||
|
98 | units: | |||
|
99 | byte: | |||
|
100 | one: "Byte" | |||
|
101 | other: "Bytes" | |||
|
102 | kb: "KB" | |||
|
103 | mb: "MB" | |||
|
104 | gb: "GB" | |||
|
105 | tb: "TB" | |||
96 | support: |
|
106 | support: | |
97 | array: |
|
107 | array: | |
98 | sentence_connector: "e" |
|
108 | sentence_connector: "e" |
@@ -83,6 +83,16 pt: | |||||
83 | format: |
|
83 | format: | |
84 | precision: 1 |
|
84 | precision: 1 | |
85 | delimiter: '' |
|
85 | delimiter: '' | |
|
86 | storage_units: | |||
|
87 | format: "%n %u" | |||
|
88 | units: | |||
|
89 | byte: | |||
|
90 | one: "Byte" | |||
|
91 | other: "Bytes" | |||
|
92 | kb: "KB" | |||
|
93 | mb: "MB" | |||
|
94 | gb: "GB" | |||
|
95 | tb: "TB" | |||
86 |
|
96 | |||
87 | activerecord: |
|
97 | activerecord: | |
88 | errors: |
|
98 | errors: |
@@ -57,6 +57,22 ro: | |||||
57 | over_x_years: |
|
57 | over_x_years: | |
58 | one: "peste un an" |
|
58 | one: "peste un an" | |
59 | other: "peste {{count}} ani" |
|
59 | other: "peste {{count}} ani" | |
|
60 | ||||
|
61 | number: | |||
|
62 | human: | |||
|
63 | format: | |||
|
64 | precision: 1 | |||
|
65 | delimiter: "" | |||
|
66 | storage_units: | |||
|
67 | format: "%n %u" | |||
|
68 | units: | |||
|
69 | kb: KB | |||
|
70 | tb: TB | |||
|
71 | gb: GB | |||
|
72 | byte: | |||
|
73 | one: Byte | |||
|
74 | other: Bytes | |||
|
75 | mb: MB | |||
60 |
|
76 | |||
61 | # Used in array.to_sentence. |
|
77 | # Used in array.to_sentence. | |
62 | support: |
|
78 | support: |
@@ -59,6 +59,22 sk: | |||||
59 | over_x_years: |
|
59 | over_x_years: | |
60 | one: "cez 1 rok" |
|
60 | one: "cez 1 rok" | |
61 | other: "cez {{count}} roky/ov" |
|
61 | other: "cez {{count}} roky/ov" | |
|
62 | ||||
|
63 | number: | |||
|
64 | human: | |||
|
65 | format: | |||
|
66 | precision: 1 | |||
|
67 | delimiter: "" | |||
|
68 | storage_units: | |||
|
69 | format: "%n %u" | |||
|
70 | units: | |||
|
71 | kb: KB | |||
|
72 | tb: TB | |||
|
73 | gb: GB | |||
|
74 | byte: | |||
|
75 | one: Byte | |||
|
76 | other: Bytes | |||
|
77 | mb: MB | |||
62 |
|
78 | |||
63 | # Used in array.to_sentence. |
|
79 | # Used in array.to_sentence. | |
64 | support: |
|
80 | support: |
@@ -59,6 +59,22 sl: | |||||
59 | over_x_years: |
|
59 | over_x_years: | |
60 | one: "over 1 year" |
|
60 | one: "over 1 year" | |
61 | other: "over {{count}} years" |
|
61 | other: "over {{count}} years" | |
|
62 | ||||
|
63 | number: | |||
|
64 | human: | |||
|
65 | format: | |||
|
66 | precision: 1 | |||
|
67 | delimiter: "" | |||
|
68 | storage_units: | |||
|
69 | format: "%n %u" | |||
|
70 | units: | |||
|
71 | kb: KB | |||
|
72 | tb: TB | |||
|
73 | gb: GB | |||
|
74 | byte: | |||
|
75 | one: Byte | |||
|
76 | other: Bytes | |||
|
77 | mb: MB | |||
62 |
|
78 | |||
63 | # Used in array.to_sentence. |
|
79 | # Used in array.to_sentence. | |
64 | support: |
|
80 | support: |
@@ -81,6 +81,17 | |||||
81 | unit: 'ДИН' |
|
81 | unit: 'ДИН' | |
82 | precision: 2 |
|
82 | precision: 2 | |
83 | format: '%n %u' |
|
83 | format: '%n %u' | |
|
84 | human: | |||
|
85 | storage_units: | |||
|
86 | format: "%n %u" | |||
|
87 | units: | |||
|
88 | byte: | |||
|
89 | one: "Byte" | |||
|
90 | other: "Bytes" | |||
|
91 | kb: "KB" | |||
|
92 | mb: "MB" | |||
|
93 | gb: "GB" | |||
|
94 | tb: "TB" | |||
84 |
|
95 | |||
85 | support: |
|
96 | support: | |
86 | array: |
|
97 | array: |
@@ -47,7 +47,16 sv: | |||||
47 | # separator: |
|
47 | # separator: | |
48 | delimiter: "" |
|
48 | delimiter: "" | |
49 | # precision: 1 |
|
49 | # precision: 1 | |
50 |
storage_units: |
|
50 | storage_units: | |
|
51 | format: "%n %u" | |||
|
52 | units: | |||
|
53 | byte: | |||
|
54 | one: "Byte" | |||
|
55 | other: "Bytes" | |||
|
56 | kb: "KB" | |||
|
57 | mb: "MB" | |||
|
58 | gb: "GB" | |||
|
59 | tb: "TB" | |||
51 |
|
60 | |||
52 | # Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words() |
|
61 | # Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words() | |
53 | datetime: |
|
62 | datetime: |
@@ -59,6 +59,22 th: | |||||
59 | over_x_years: |
|
59 | over_x_years: | |
60 | one: "over 1 year" |
|
60 | one: "over 1 year" | |
61 | other: "over {{count}} years" |
|
61 | other: "over {{count}} years" | |
|
62 | ||||
|
63 | number: | |||
|
64 | human: | |||
|
65 | format: | |||
|
66 | precision: 1 | |||
|
67 | delimiter: "" | |||
|
68 | storage_units: | |||
|
69 | format: "%n %u" | |||
|
70 | units: | |||
|
71 | kb: KB | |||
|
72 | tb: TB | |||
|
73 | gb: GB | |||
|
74 | byte: | |||
|
75 | one: Byte | |||
|
76 | other: Bytes | |||
|
77 | mb: MB | |||
62 |
|
78 | |||
63 | # Used in array.to_sentence. |
|
79 | # Used in array.to_sentence. | |
64 | support: |
|
80 | support: |
@@ -92,6 +92,16 tr: | |||||
92 | delimiter: '.' |
|
92 | delimiter: '.' | |
93 | separator: ',' |
|
93 | separator: ',' | |
94 | precision: 2 |
|
94 | precision: 2 | |
|
95 | storage_units: | |||
|
96 | format: "%n %u" | |||
|
97 | units: | |||
|
98 | byte: | |||
|
99 | one: "Byte" | |||
|
100 | other: "Bytes" | |||
|
101 | kb: "KB" | |||
|
102 | mb: "MB" | |||
|
103 | gb: "GB" | |||
|
104 | tb: "TB" | |||
95 |
|
105 | |||
96 | support: |
|
106 | support: | |
97 | array: |
|
107 | array: |
@@ -59,6 +59,22 uk: | |||||
59 | over_x_years: |
|
59 | over_x_years: | |
60 | one: "over 1 year" |
|
60 | one: "over 1 year" | |
61 | other: "over {{count}} years" |
|
61 | other: "over {{count}} years" | |
|
62 | ||||
|
63 | number: | |||
|
64 | human: | |||
|
65 | format: | |||
|
66 | precision: 1 | |||
|
67 | delimiter: "" | |||
|
68 | storage_units: | |||
|
69 | format: "%n %u" | |||
|
70 | units: | |||
|
71 | kb: KB | |||
|
72 | tb: TB | |||
|
73 | gb: GB | |||
|
74 | byte: | |||
|
75 | one: Byte | |||
|
76 | other: Bytes | |||
|
77 | mb: MB | |||
62 |
|
78 | |||
63 | # Used in array.to_sentence. |
|
79 | # Used in array.to_sentence. | |
64 | support: |
|
80 | support: |
@@ -49,7 +49,16 vi: | |||||
49 | # separator: |
|
49 | # separator: | |
50 | delimiter: "" |
|
50 | delimiter: "" | |
51 | precision: 1 |
|
51 | precision: 1 | |
52 |
storage_units: |
|
52 | storage_units: | |
|
53 | format: "%n %u" | |||
|
54 | units: | |||
|
55 | byte: | |||
|
56 | one: "Byte" | |||
|
57 | other: "Bytes" | |||
|
58 | kb: "KB" | |||
|
59 | mb: "MB" | |||
|
60 | gb: "GB" | |||
|
61 | tb: "TB" | |||
53 |
|
62 | |||
54 | # Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words() |
|
63 | # Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words() | |
55 | datetime: |
|
64 | datetime: |
@@ -86,8 +86,9 | |||||
86 | precision: 1 |
|
86 | precision: 1 | |
87 | # 儲存單位輸出格式. |
|
87 | # 儲存單位輸出格式. | |
88 | # %u 是儲存單位, %n 是數值 (預設值: 2 MB) |
|
88 | # %u 是儲存單位, %n 是數值 (預設值: 2 MB) | |
|
89 | storage_units: | |||
89 | format: "%n %u" |
|
90 | format: "%n %u" | |
90 |
|
|
91 | units: | |
91 | byte: |
|
92 | byte: | |
92 | one: "位元組 (B)" |
|
93 | one: "位元組 (B)" | |
93 | other: "位元組 (B)" |
|
94 | other: "位元組 (B)" |
@@ -86,7 +86,16 zh: | |||||
86 | format: |
|
86 | format: | |
87 | delimiter: "" |
|
87 | delimiter: "" | |
88 | precision: 1 |
|
88 | precision: 1 | |
89 |
storage_units: |
|
89 | storage_units: | |
|
90 | format: "%n %u" | |||
|
91 | units: | |||
|
92 | byte: | |||
|
93 | one: "Byte" | |||
|
94 | other: "Bytes" | |||
|
95 | kb: "KB" | |||
|
96 | mb: "MB" | |||
|
97 | gb: "GB" | |||
|
98 | tb: "TB" | |||
90 |
|
99 | |||
91 | support: |
|
100 | support: | |
92 | array: |
|
101 | array: |
@@ -6,11 +6,6 ActionController::Routing::Routes.draw do |map| | |||||
6 | # map.connect 'products/:id', :controller => 'catalog', :action => 'view' |
|
6 | # map.connect 'products/:id', :controller => 'catalog', :action => 'view' | |
7 | # Keep in mind you can assign values other than :controller and :action |
|
7 | # Keep in mind you can assign values other than :controller and :action | |
8 |
|
8 | |||
9 | # Allow Redmine plugins to map routes and potentially override them |
|
|||
10 | Rails.plugins.each do |plugin| |
|
|||
11 | map.from_plugin plugin.name.to_sym |
|
|||
12 | end |
|
|||
13 |
|
||||
14 | map.home '', :controller => 'welcome' |
|
9 | map.home '', :controller => 'welcome' | |
15 |
|
10 | |||
16 | map.signin 'login', :controller => 'account', :action => 'login' |
|
11 | map.signin 'login', :controller => 'account', :action => 'login' |
@@ -43,7 +43,7 class TabularFormBuilder < ActionView::Helpers::FormBuilder | |||||
43 | return '' if options.delete(:no_label) |
|
43 | return '' if options.delete(:no_label) | |
44 | text = options[:label].is_a?(Symbol) ? l(options[:label]) : options[:label] |
|
44 | text = options[:label].is_a?(Symbol) ? l(options[:label]) : options[:label] | |
45 | text ||= l(("field_" + field.to_s.gsub(/\_id$/, "")).to_sym) |
|
45 | text ||= l(("field_" + field.to_s.gsub(/\_id$/, "")).to_sym) | |
46 |
text |
|
46 | text += @template.content_tag("span", " *", :class => "required") if options.delete(:required) | |
47 | @template.content_tag("label", text, |
|
47 | @template.content_tag("label", text, | |
48 | :class => (@object && @object.errors[field] ? "error" : nil), |
|
48 | :class => (@object && @object.errors[field] ? "error" : nil), | |
49 | :for => (@object_name.to_s + "_" + field.to_s)) |
|
49 | :for => (@object_name.to_s + "_" + field.to_s)) |
@@ -21,7 +21,7 require 'account_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class AccountController; def rescue_action(e) raise e end; end |
|
22 | class AccountController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class AccountControllerTest < |
|
24 | class AccountControllerTest < ActionController::TestCase | |
25 | fixtures :users, :roles |
|
25 | fixtures :users, :roles | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'admin_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class AdminController; def rescue_action(e) raise e end; end |
|
22 | class AdminController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class AdminControllerTest < |
|
24 | class AdminControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :roles |
|
25 | fixtures :projects, :users, :roles | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -16,12 +16,12 | |||||
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 | require 'application' |
|
19 | require 'application_controller' | |
20 |
|
20 | |||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class ApplicationController; def rescue_action(e) raise e end; end |
|
22 | class ApplicationController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class ApplicationControllerTest < |
|
24 | class ApplicationControllerTest < ActionController::TestCase | |
25 | include Redmine::I18n |
|
25 | include Redmine::I18n | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -22,7 +22,7 require 'attachments_controller' | |||||
22 | class AttachmentsController; def rescue_action(e) raise e end; end |
|
22 | class AttachmentsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
|
24 | |||
25 |
class AttachmentsControllerTest < |
|
25 | class AttachmentsControllerTest < ActionController::TestCase | |
26 | fixtures :users, :projects, :roles, :members, :member_roles, :enabled_modules, :issues, :trackers, :attachments, |
|
26 | fixtures :users, :projects, :roles, :members, :member_roles, :enabled_modules, :issues, :trackers, :attachments, | |
27 | :versions, :wiki_pages, :wikis, :documents |
|
27 | :versions, :wiki_pages, :wikis, :documents | |
28 |
|
28 |
@@ -21,7 +21,7 require 'boards_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class BoardsController; def rescue_action(e) raise e end; end |
|
22 | class BoardsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class BoardsControllerTest < |
|
24 | class BoardsControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :members, :member_roles, :roles, :boards, :messages, :enabled_modules |
|
25 | fixtures :projects, :users, :members, :member_roles, :roles, :boards, :messages, :enabled_modules | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'custom_fields_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class CustomFieldsController; def rescue_action(e) raise e end; end |
|
22 | class CustomFieldsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class CustomFieldsControllerTest < |
|
24 | class CustomFieldsControllerTest < ActionController::TestCase | |
25 | fixtures :custom_fields, :trackers, :users |
|
25 | fixtures :custom_fields, :trackers, :users | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'documents_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class DocumentsController; def rescue_action(e) raise e end; end |
|
22 | class DocumentsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class DocumentsControllerTest < |
|
24 | class DocumentsControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :documents, :enumerations |
|
25 | fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :documents, :enumerations | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'enumerations_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class EnumerationsController; def rescue_action(e) raise e end; end |
|
22 | class EnumerationsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class EnumerationsControllerTest < |
|
24 | class EnumerationsControllerTest < ActionController::TestCase | |
25 | fixtures :enumerations, :issues, :users |
|
25 | fixtures :enumerations, :issues, :users | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'groups_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class GroupsController; def rescue_action(e) raise e end; end |
|
22 | class GroupsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class GroupsControllerTest < |
|
24 | class GroupsControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :members, :member_roles |
|
25 | fixtures :projects, :users, :members, :member_roles | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'issue_categories_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class IssueCategoriesController; def rescue_action(e) raise e end; end |
|
22 | class IssueCategoriesController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class IssueCategoriesControllerTest < |
|
24 | class IssueCategoriesControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :members, :member_roles, :roles, :enabled_modules, :issue_categories |
|
25 | fixtures :projects, :users, :members, :member_roles, :roles, :enabled_modules, :issue_categories | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -5,7 +5,7 require 'issue_relations_controller' | |||||
5 | class IssueRelationsController; def rescue_action(e) raise e end; end |
|
5 | class IssueRelationsController; def rescue_action(e) raise e end; end | |
6 |
|
6 | |||
7 |
|
7 | |||
8 |
class IssueRelationsControllerTest < |
|
8 | class IssueRelationsControllerTest < ActionController::TestCase | |
9 | fixtures :projects, |
|
9 | fixtures :projects, | |
10 | :users, |
|
10 | :users, | |
11 | :roles, |
|
11 | :roles, |
@@ -21,7 +21,7 require 'issues_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class IssuesController; def rescue_action(e) raise e end; end |
|
22 | class IssuesController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class IssuesControllerTest < |
|
24 | class IssuesControllerTest < ActionController::TestCase | |
25 | fixtures :projects, |
|
25 | fixtures :projects, | |
26 | :users, |
|
26 | :users, | |
27 | :roles, |
|
27 | :roles, | |
@@ -42,7 +42,8 class IssuesControllerTest < Test::Unit::TestCase | |||||
42 | :custom_fields_trackers, |
|
42 | :custom_fields_trackers, | |
43 | :time_entries, |
|
43 | :time_entries, | |
44 | :journals, |
|
44 | :journals, | |
45 | :journal_details |
|
45 | :journal_details, | |
|
46 | :queries | |||
46 |
|
47 | |||
47 | def setup |
|
48 | def setup | |
48 | @controller = IssuesController.new |
|
49 | @controller = IssuesController.new | |
@@ -452,14 +453,16 class IssuesControllerTest < Test::Unit::TestCase | |||||
452 |
|
453 | |||
453 | def test_post_new |
|
454 | def test_post_new | |
454 | @request.session[:user_id] = 2 |
|
455 | @request.session[:user_id] = 2 | |
455 | post :new, :project_id => 1, |
|
456 | assert_difference 'Issue.count' do | |
456 | :issue => {:tracker_id => 3, |
|
457 | post :new, :project_id => 1, | |
457 | :subject => 'This is the test_new issue', |
|
458 | :issue => {:tracker_id => 3, | |
458 |
: |
|
459 | :subject => 'This is the test_new issue', | |
459 |
|
|
460 | :description => 'This is the description', | |
460 |
|
|
461 | :priority_id => 5, | |
461 |
|
|
462 | :estimated_hours => '', | |
462 | assert_redirected_to :action => 'show' |
|
463 | :custom_field_values => {'2' => 'Value for field 2'}} | |
|
464 | end | |||
|
465 | assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id | |||
463 |
|
466 | |||
464 | issue = Issue.find_by_subject('This is the test_new issue') |
|
467 | issue = Issue.find_by_subject('This is the test_new issue') | |
465 | assert_not_nil issue |
|
468 | assert_not_nil issue | |
@@ -483,12 +486,14 class IssuesControllerTest < Test::Unit::TestCase | |||||
483 |
|
486 | |||
484 | def test_post_new_without_custom_fields_param |
|
487 | def test_post_new_without_custom_fields_param | |
485 | @request.session[:user_id] = 2 |
|
488 | @request.session[:user_id] = 2 | |
486 | post :new, :project_id => 1, |
|
489 | assert_difference 'Issue.count' do | |
487 | :issue => {:tracker_id => 1, |
|
490 | post :new, :project_id => 1, | |
488 | :subject => 'This is the test_new issue', |
|
491 | :issue => {:tracker_id => 1, | |
489 |
: |
|
492 | :subject => 'This is the test_new issue', | |
490 | :priority_id => 5} |
|
493 | :description => 'This is the description', | |
491 | assert_redirected_to :action => 'show' |
|
494 | :priority_id => 5} | |
|
495 | end | |||
|
496 | assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id | |||
492 | end |
|
497 | end | |
493 |
|
498 | |||
494 | def test_post_new_with_required_custom_field_and_without_custom_fields_param |
|
499 | def test_post_new_with_required_custom_field_and_without_custom_fields_param | |
@@ -536,14 +541,16 class IssuesControllerTest < Test::Unit::TestCase | |||||
536 | def test_post_new_should_send_a_notification |
|
541 | def test_post_new_should_send_a_notification | |
537 | ActionMailer::Base.deliveries.clear |
|
542 | ActionMailer::Base.deliveries.clear | |
538 | @request.session[:user_id] = 2 |
|
543 | @request.session[:user_id] = 2 | |
539 | post :new, :project_id => 1, |
|
544 | assert_difference 'Issue.count' do | |
540 | :issue => {:tracker_id => 3, |
|
545 | post :new, :project_id => 1, | |
541 | :subject => 'This is the test_new issue', |
|
546 | :issue => {:tracker_id => 3, | |
542 |
: |
|
547 | :subject => 'This is the test_new issue', | |
543 |
|
|
548 | :description => 'This is the description', | |
544 |
|
|
549 | :priority_id => 5, | |
545 |
|
|
550 | :estimated_hours => '', | |
546 | assert_redirected_to :action => 'show' |
|
551 | :custom_field_values => {'2' => 'Value for field 2'}} | |
|
552 | end | |||
|
553 | assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id | |||
547 |
|
554 | |||
548 | assert_equal 1, ActionMailer::Base.deliveries.size |
|
555 | assert_equal 1, ActionMailer::Base.deliveries.size | |
549 | end |
|
556 | end |
@@ -21,7 +21,7 require 'journals_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class JournalsController; def rescue_action(e) raise e end; end |
|
22 | class JournalsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class JournalsControllerTest < |
|
24 | class JournalsControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :members, :member_roles, :roles, :issues, :journals, :journal_details, :enabled_modules |
|
25 | fixtures :projects, :users, :members, :member_roles, :roles, :issues, :journals, :journal_details, :enabled_modules | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'mail_handler_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class MailHandlerController; def rescue_action(e) raise e end; end |
|
22 | class MailHandlerController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class MailHandlerControllerTest < |
|
24 | class MailHandlerControllerTest < ActionController::TestCase | |
25 | fixtures :users, :projects, :enabled_modules, :roles, :members, :member_roles, :issues, :issue_statuses, :trackers, :enumerations |
|
25 | fixtures :users, :projects, :enabled_modules, :roles, :members, :member_roles, :issues, :issue_statuses, :trackers, :enumerations | |
26 |
|
26 | |||
27 | FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures/mail_handler' |
|
27 | FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures/mail_handler' |
@@ -22,7 +22,7 require 'members_controller' | |||||
22 | class MembersController; def rescue_action(e) raise e end; end |
|
22 | class MembersController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
|
24 | |||
25 |
class MembersControllerTest < |
|
25 | class MembersControllerTest < ActionController::TestCase | |
26 | fixtures :projects, :members, :member_roles, :roles, :users |
|
26 | fixtures :projects, :members, :member_roles, :roles, :users | |
27 |
|
27 | |||
28 | def setup |
|
28 | def setup |
@@ -21,7 +21,7 require 'messages_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class MessagesController; def rescue_action(e) raise e end; end |
|
22 | class MessagesController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class MessagesControllerTest < |
|
24 | class MessagesControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :members, :member_roles, :roles, :boards, :messages, :enabled_modules |
|
25 | fixtures :projects, :users, :members, :member_roles, :roles, :boards, :messages, :enabled_modules | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'my_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class MyController; def rescue_action(e) raise e end; end |
|
22 | class MyController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class MyControllerTest < |
|
24 | class MyControllerTest < ActionController::TestCase | |
25 | fixtures :users, :issues, :issue_statuses, :trackers, :enumerations, :custom_fields |
|
25 | fixtures :users, :issues, :issue_statuses, :trackers, :enumerations, :custom_fields | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'news_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class NewsController; def rescue_action(e) raise e end; end |
|
22 | class NewsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class NewsControllerTest < |
|
24 | class NewsControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :news, :comments |
|
25 | fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :news, :comments | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'projects_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class ProjectsController; def rescue_action(e) raise e end; end |
|
22 | class ProjectsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class ProjectsControllerTest < |
|
24 | class ProjectsControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :versions, :users, :roles, :members, :member_roles, :issues, :journals, :journal_details, |
|
25 | fixtures :projects, :versions, :users, :roles, :members, :member_roles, :issues, :journals, :journal_details, | |
26 | :trackers, :projects_trackers, :issue_statuses, :enabled_modules, :enumerations, :boards, :messages, |
|
26 | :trackers, :projects_trackers, :issue_statuses, :enabled_modules, :enumerations, :boards, :messages, | |
27 | :attachments |
|
27 | :attachments |
@@ -21,7 +21,7 require 'queries_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class QueriesController; def rescue_action(e) raise e end; end |
|
22 | class QueriesController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class QueriesControllerTest < |
|
24 | class QueriesControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :members, :member_roles, :roles, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :custom_fields, :custom_values, :queries |
|
25 | fixtures :projects, :users, :members, :member_roles, :roles, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :custom_fields, :custom_values, :queries | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup | |
@@ -70,7 +70,7 class QueriesControllerTest < Test::Unit::TestCase | |||||
70 | :query => {"name" => "test_new_project_public_query", "is_public" => "1"} |
|
70 | :query => {"name" => "test_new_project_public_query", "is_public" => "1"} | |
71 |
|
71 | |||
72 | q = Query.find_by_name('test_new_project_public_query') |
|
72 | q = Query.find_by_name('test_new_project_public_query') | |
73 | assert_redirected_to :controller => 'issues', :action => 'index', :query_id => q |
|
73 | assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q | |
74 | assert q.is_public? |
|
74 | assert q.is_public? | |
75 | assert q.has_default_columns? |
|
75 | assert q.has_default_columns? | |
76 | assert q.valid? |
|
76 | assert q.valid? | |
@@ -88,7 +88,7 class QueriesControllerTest < Test::Unit::TestCase | |||||
88 | :query => {"name" => "test_new_project_private_query", "is_public" => "1"} |
|
88 | :query => {"name" => "test_new_project_private_query", "is_public" => "1"} | |
89 |
|
89 | |||
90 | q = Query.find_by_name('test_new_project_private_query') |
|
90 | q = Query.find_by_name('test_new_project_private_query') | |
91 | assert_redirected_to :controller => 'issues', :action => 'index', :query_id => q |
|
91 | assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q | |
92 | assert !q.is_public? |
|
92 | assert !q.is_public? | |
93 | assert q.has_default_columns? |
|
93 | assert q.has_default_columns? | |
94 | assert q.valid? |
|
94 | assert q.valid? | |
@@ -104,7 +104,7 class QueriesControllerTest < Test::Unit::TestCase | |||||
104 | :query => {"name" => "test_new_global_private_query", "is_public" => "1", "column_names" => ["", "tracker", "subject", "priority", "category"]} |
|
104 | :query => {"name" => "test_new_global_private_query", "is_public" => "1", "column_names" => ["", "tracker", "subject", "priority", "category"]} | |
105 |
|
105 | |||
106 | q = Query.find_by_name('test_new_global_private_query') |
|
106 | q = Query.find_by_name('test_new_global_private_query') | |
107 | assert_redirected_to :controller => 'issues', :action => 'index', :query_id => q |
|
107 | assert_redirected_to :controller => 'issues', :action => 'index', :project_id => nil, :query_id => q | |
108 | assert !q.is_public? |
|
108 | assert !q.is_public? | |
109 | assert !q.has_default_columns? |
|
109 | assert !q.has_default_columns? | |
110 | assert_equal [:tracker, :subject, :priority, :category], q.columns.collect {|c| c.name} |
|
110 | assert_equal [:tracker, :subject, :priority, :category], q.columns.collect {|c| c.name} |
@@ -22,7 +22,7 require 'reports_controller' | |||||
22 | class ReportsController; def rescue_action(e) raise e end; end |
|
22 | class ReportsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
|
24 | |||
25 |
class ReportsControllerTest < |
|
25 | class ReportsControllerTest < ActionController::TestCase | |
26 | fixtures :all |
|
26 | fixtures :all | |
27 |
|
27 | |||
28 | def setup |
|
28 | def setup |
@@ -21,7 +21,7 require 'repositories_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class RepositoriesController; def rescue_action(e) raise e end; end |
|
22 | class RepositoriesController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class RepositoriesBazaarControllerTest < |
|
24 | class RepositoriesBazaarControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules |
|
25 | fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules | |
26 |
|
26 | |||
27 | # No '..' in the repository path |
|
27 | # No '..' in the repository path |
@@ -21,7 +21,7 require 'repositories_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class RepositoriesController; def rescue_action(e) raise e end; end |
|
22 | class RepositoriesController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class RepositoriesControllerTest < |
|
24 | class RepositoriesControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers |
|
25 | fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'repositories_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class RepositoriesController; def rescue_action(e) raise e end; end |
|
22 | class RepositoriesController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class RepositoriesCvsControllerTest < |
|
24 | class RepositoriesCvsControllerTest < ActionController::TestCase | |
25 |
|
25 | |||
26 | # No '..' in the repository path |
|
26 | # No '..' in the repository path | |
27 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/cvs_repository' |
|
27 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/cvs_repository' |
@@ -21,7 +21,7 require 'repositories_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class RepositoriesController; def rescue_action(e) raise e end; end |
|
22 | class RepositoriesController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class RepositoriesDarcsControllerTest < |
|
24 | class RepositoriesDarcsControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules |
|
25 | fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules | |
26 |
|
26 | |||
27 | # No '..' in the repository path |
|
27 | # No '..' in the repository path |
@@ -21,7 +21,7 require 'repositories_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class RepositoriesController; def rescue_action(e) raise e end; end |
|
22 | class RepositoriesController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class RepositoriesGitControllerTest < |
|
24 | class RepositoriesGitControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules |
|
25 | fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules | |
26 |
|
26 | |||
27 | # No '..' in the repository path |
|
27 | # No '..' in the repository path |
@@ -21,7 +21,7 require 'repositories_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class RepositoriesController; def rescue_action(e) raise e end; end |
|
22 | class RepositoriesController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class RepositoriesMercurialControllerTest < |
|
24 | class RepositoriesMercurialControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules |
|
25 | fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules | |
26 |
|
26 | |||
27 | # No '..' in the repository path |
|
27 | # No '..' in the repository path |
@@ -21,7 +21,7 require 'repositories_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class RepositoriesController; def rescue_action(e) raise e end; end |
|
22 | class RepositoriesController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class RepositoriesSubversionControllerTest < |
|
24 | class RepositoriesSubversionControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, |
|
25 | fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, | |
26 | :repositories, :issues, :issue_statuses, :changesets, :changes, |
|
26 | :repositories, :issues, :issue_statuses, :changesets, :changes, | |
27 | :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers |
|
27 | :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers |
@@ -21,7 +21,7 require 'roles_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class RolesController; def rescue_action(e) raise e end; end |
|
22 | class RolesController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class RolesControllerTest < |
|
24 | class RolesControllerTest < ActionController::TestCase | |
25 | fixtures :roles, :users, :members, :member_roles, :workflows |
|
25 | fixtures :roles, :users, :members, :member_roles, :workflows | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -4,7 +4,7 require 'search_controller' | |||||
4 | # Re-raise errors caught by the controller. |
|
4 | # Re-raise errors caught by the controller. | |
5 | class SearchController; def rescue_action(e) raise e end; end |
|
5 | class SearchController; def rescue_action(e) raise e end; end | |
6 |
|
6 | |||
7 |
class SearchControllerTest < |
|
7 | class SearchControllerTest < ActionController::TestCase | |
8 | fixtures :projects, :enabled_modules, :roles, :users, :members, :member_roles, |
|
8 | fixtures :projects, :enabled_modules, :roles, :users, :members, :member_roles, | |
9 | :issues, :trackers, :issue_statuses, |
|
9 | :issues, :trackers, :issue_statuses, | |
10 | :custom_fields, :custom_values, |
|
10 | :custom_fields, :custom_values, |
@@ -21,7 +21,7 require 'settings_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class SettingsController; def rescue_action(e) raise e end; end |
|
22 | class SettingsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class SettingsControllerTest < |
|
24 | class SettingsControllerTest < ActionController::TestCase | |
25 | fixtures :users |
|
25 | fixtures :users | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'sys_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class SysController; def rescue_action(e) raise e end; end |
|
22 | class SysController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class SysControllerTest < |
|
24 | class SysControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :repositories |
|
25 | fixtures :projects, :repositories | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'timelog_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class TimelogController; def rescue_action(e) raise e end; end |
|
22 | class TimelogController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class TimelogControllerTest < |
|
24 | class TimelogControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :enabled_modules, :roles, :members, :member_roles, :issues, :time_entries, :users, :trackers, :enumerations, :issue_statuses, :custom_fields, :custom_values |
|
25 | fixtures :projects, :enabled_modules, :roles, :members, :member_roles, :issues, :time_entries, :users, :trackers, :enumerations, :issue_statuses, :custom_fields, :custom_values | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'trackers_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class TrackersController; def rescue_action(e) raise e end; end |
|
22 | class TrackersController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class TrackersControllerTest < |
|
24 | class TrackersControllerTest < ActionController::TestCase | |
25 | fixtures :trackers, :projects, :projects_trackers, :users, :issues |
|
25 | fixtures :trackers, :projects, :projects_trackers, :users, :issues | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'users_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class UsersController; def rescue_action(e) raise e end; end |
|
22 | class UsersController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class UsersControllerTest < |
|
24 | class UsersControllerTest < ActionController::TestCase | |
25 | include Redmine::I18n |
|
25 | include Redmine::I18n | |
26 |
|
26 | |||
27 | fixtures :users, :projects, :members, :member_roles, :roles |
|
27 | fixtures :users, :projects, :members, :member_roles, :roles |
@@ -21,7 +21,7 require 'versions_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class VersionsController; def rescue_action(e) raise e end; end |
|
22 | class VersionsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class VersionsControllerTest < |
|
24 | class VersionsControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :versions, :issues, :users, :roles, :members, :member_roles, :enabled_modules |
|
25 | fixtures :projects, :versions, :issues, :users, :roles, :members, :member_roles, :enabled_modules | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'watchers_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class WatchersController; def rescue_action(e) raise e end; end |
|
22 | class WatchersController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class WatchersControllerTest < |
|
24 | class WatchersControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, |
|
25 | fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, | |
26 | :issues, :trackers, :projects_trackers, :issue_statuses, :enumerations, :watchers |
|
26 | :issues, :trackers, :projects_trackers, :issue_statuses, :enumerations, :watchers | |
27 |
|
27 |
@@ -21,7 +21,7 require 'welcome_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class WelcomeController; def rescue_action(e) raise e end; end |
|
22 | class WelcomeController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class WelcomeControllerTest < |
|
24 | class WelcomeControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :news |
|
25 | fixtures :projects, :news | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'wiki_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class WikiController; def rescue_action(e) raise e end; end |
|
22 | class WikiController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class WikiControllerTest < |
|
24 | class WikiControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions, :attachments |
|
25 | fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions, :attachments | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'wikis_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class WikisController; def rescue_action(e) raise e end; end |
|
22 | class WikisController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class WikisControllerTest < |
|
24 | class WikisControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :wikis |
|
25 | fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :wikis | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -21,7 +21,7 require 'workflows_controller' | |||||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class WorkflowsController; def rescue_action(e) raise e end; end |
|
22 | class WorkflowsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 |
class WorkflowsControllerTest < |
|
24 | class WorkflowsControllerTest < ActionController::TestCase | |
25 | fixtures :roles, :trackers, :workflows |
|
25 | fixtures :roles, :trackers, :workflows | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup |
@@ -4,7 +4,7 class StubController < ApplicationController | |||||
4 | attr_accessor :request, :url |
|
4 | attr_accessor :request, :url | |
5 | end |
|
5 | end | |
6 |
|
6 | |||
7 |
class HelperTestCase < |
|
7 | class HelperTestCase < ActiveSupport::TestCase | |
8 |
|
8 | |||
9 | # Add other helpers here if you need them |
|
9 | # Add other helpers here if you need them | |
10 | include ActionView::Helpers::ActiveRecordHelper |
|
10 | include ActionView::Helpers::ActiveRecordHelper |
@@ -21,7 +21,7 require 'test_help' | |||||
21 | require File.expand_path(File.dirname(__FILE__) + '/helper_testcase') |
|
21 | require File.expand_path(File.dirname(__FILE__) + '/helper_testcase') | |
22 | require File.join(RAILS_ROOT,'test', 'mocks', 'open_id_authentication_mock.rb') |
|
22 | require File.join(RAILS_ROOT,'test', 'mocks', 'open_id_authentication_mock.rb') | |
23 |
|
23 | |||
24 |
class |
|
24 | class ActiveSupport::TestCase | |
25 | # Transactional fixtures accelerate your tests by wrapping each test method |
|
25 | # Transactional fixtures accelerate your tests by wrapping each test method | |
26 | # in a transaction that's rolled back on completion. This ensures that the |
|
26 | # in a transaction that's rolled back on completion. This ensures that the | |
27 | # test database remains unchanged so your fixtures don't have to be reloaded |
|
27 | # test database remains unchanged so your fixtures don't have to be reloaded | |
@@ -55,7 +55,7 class Test::Unit::TestCase | |||||
55 | end |
|
55 | end | |
56 |
|
56 | |||
57 | def test_uploaded_file(name, mime) |
|
57 | def test_uploaded_file(name, mime) | |
58 |
ActionController::TestUploadedFile.new( |
|
58 | ActionController::TestUploadedFile.new(ActiveSupport::TestCase.fixture_path + "/files/#{name}", mime) | |
59 | end |
|
59 | end | |
60 |
|
60 | |||
61 | # Use a temporary directory for attachment related tests |
|
61 | # Use a temporary directory for attachment related tests |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class ActivityTest < |
|
20 | class ActivityTest < ActiveSupport::TestCase | |
21 | fixtures :projects, :versions, :attachments, :users, :roles, :members, :member_roles, :issues, :journals, :journal_details, |
|
21 | fixtures :projects, :versions, :attachments, :users, :roles, :members, :member_roles, :issues, :journals, :journal_details, | |
22 | :trackers, :projects_trackers, :issue_statuses, :enabled_modules, :enumerations, :boards, :messages |
|
22 | :trackers, :projects_trackers, :issue_statuses, :enabled_modules, :enumerations, :boards, :messages | |
23 |
|
23 |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class AttachmentTest < |
|
20 | class AttachmentTest < ActiveSupport::TestCase | |
21 | fixtures :issues, :users |
|
21 | fixtures :issues, :users | |
22 |
|
22 | |||
23 | def setup |
|
23 | def setup |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class AuthSourceLdapTest < |
|
20 | class AuthSourceLdapTest < ActiveSupport::TestCase | |
21 |
|
21 | |||
22 | def setup |
|
22 | def setup | |
23 | end |
|
23 | end |
@@ -1,6 +1,6 | |||||
1 | require File.dirname(__FILE__) + '/../test_helper' |
|
1 | require File.dirname(__FILE__) + '/../test_helper' | |
2 |
|
2 | |||
3 |
class BoardTest < |
|
3 | class BoardTest < ActiveSupport::TestCase | |
4 | fixtures :projects, :boards, :messages |
|
4 | fixtures :projects, :boards, :messages | |
5 |
|
5 | |||
6 | def setup |
|
6 | def setup |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class CalendarTest < |
|
20 | class CalendarTest < ActiveSupport::TestCase | |
21 |
|
21 | |||
22 | def test_monthly |
|
22 | def test_monthly | |
23 | c = Redmine::Helpers::Calendar.new(Date.today, :fr, :month) |
|
23 | c = Redmine::Helpers::Calendar.new(Date.today, :fr, :month) |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class ChangesetTest < |
|
20 | class ChangesetTest < ActiveSupport::TestCase | |
21 | fixtures :projects, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :users, :members, :member_roles, :trackers |
|
21 | fixtures :projects, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :users, :members, :member_roles, :trackers | |
22 |
|
22 | |||
23 | def setup |
|
23 | def setup |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class CommentTest < |
|
20 | class CommentTest < ActiveSupport::TestCase | |
21 | fixtures :users, :news, :comments |
|
21 | fixtures :users, :news, :comments | |
22 |
|
22 | |||
23 | def setup |
|
23 | def setup |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class CustomFieldTest < |
|
20 | class CustomFieldTest < ActiveSupport::TestCase | |
21 | fixtures :custom_fields |
|
21 | fixtures :custom_fields | |
22 |
|
22 | |||
23 | def test_create |
|
23 | def test_create |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class CustomValueTest < |
|
20 | class CustomValueTest < ActiveSupport::TestCase | |
21 | fixtures :custom_fields |
|
21 | fixtures :custom_fields | |
22 |
|
22 | |||
23 | def test_string_field_validation_with_blank_value |
|
23 | def test_string_field_validation_with_blank_value |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class DefaultDataTest < |
|
20 | class DefaultDataTest < ActiveSupport::TestCase | |
21 | include Redmine::I18n |
|
21 | include Redmine::I18n | |
22 | fixtures :roles |
|
22 | fixtures :roles | |
23 |
|
23 |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class DocumentCategoryTest < |
|
20 | class DocumentCategoryTest < ActiveSupport::TestCase | |
21 | fixtures :enumerations, :documents |
|
21 | fixtures :enumerations, :documents | |
22 |
|
22 | |||
23 | def test_should_be_an_enumeration |
|
23 | def test_should_be_an_enumeration |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class DocumentTest < |
|
20 | class DocumentTest < ActiveSupport::TestCase | |
21 | fixtures :projects, :enumerations, :documents |
|
21 | fixtures :projects, :enumerations, :documents | |
22 |
|
22 | |||
23 | def test_create |
|
23 | def test_create |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class EnabledModuleTest < |
|
20 | class EnabledModuleTest < ActiveSupport::TestCase | |
21 | fixtures :projects, :wikis |
|
21 | fixtures :projects, :wikis | |
22 |
|
22 | |||
23 | def test_enabling_wiki_should_create_a_wiki |
|
23 | def test_enabling_wiki_should_create_a_wiki |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class EnumerationTest < |
|
20 | class EnumerationTest < ActiveSupport::TestCase | |
21 | fixtures :enumerations, :issues |
|
21 | fixtures :enumerations, :issues | |
22 |
|
22 | |||
23 | def setup |
|
23 | def setup |
@@ -2,7 +2,7 | |||||
2 | require File.dirname(__FILE__) + '/../test_helper' |
|
2 | require File.dirname(__FILE__) + '/../test_helper' | |
3 |
|
3 | |||
4 |
|
4 | |||
5 |
class FilesystemAdapterTest < |
|
5 | class FilesystemAdapterTest < ActiveSupport::TestCase | |
6 |
|
6 | |||
7 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/filesystem_repository' |
|
7 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/filesystem_repository' | |
8 |
|
8 |
@@ -1,6 +1,6 | |||||
1 | require File.dirname(__FILE__) + '/../test_helper' |
|
1 | require File.dirname(__FILE__) + '/../test_helper' | |
2 |
|
2 | |||
3 |
class GitAdapterTest < |
|
3 | class GitAdapterTest < ActiveSupport::TestCase | |
4 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/git_repository' |
|
4 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/git_repository' | |
5 |
|
5 | |||
6 | if File.directory?(REPOSITORY_PATH) |
|
6 | if File.directory?(REPOSITORY_PATH) |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class GroupTest < |
|
20 | class GroupTest < ActiveSupport::TestCase | |
21 | fixtures :all |
|
21 | fixtures :all | |
22 |
|
22 | |||
23 | def test_create |
|
23 | def test_create |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class IssueCategoryTest < |
|
20 | class IssueCategoryTest < ActiveSupport::TestCase | |
21 | fixtures :issue_categories, :issues |
|
21 | fixtures :issue_categories, :issues | |
22 |
|
22 | |||
23 | def setup |
|
23 | def setup |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class IssuePriorityTest < |
|
20 | class IssuePriorityTest < ActiveSupport::TestCase | |
21 | fixtures :enumerations, :issues |
|
21 | fixtures :enumerations, :issues | |
22 |
|
22 | |||
23 | def test_should_be_an_enumeration |
|
23 | def test_should_be_an_enumeration |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class IssueStatusTest < |
|
20 | class IssueStatusTest < ActiveSupport::TestCase | |
21 | fixtures :issue_statuses, :issues |
|
21 | fixtures :issue_statuses, :issues | |
22 |
|
22 | |||
23 | def test_create |
|
23 | def test_create |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class IssueTest < |
|
20 | class IssueTest < ActiveSupport::TestCase | |
21 | fixtures :projects, :users, :members, :member_roles, |
|
21 | fixtures :projects, :users, :members, :member_roles, | |
22 | :trackers, :projects_trackers, |
|
22 | :trackers, :projects_trackers, | |
23 | :issue_statuses, :issue_categories, :issue_relations, :workflows, |
|
23 | :issue_statuses, :issue_categories, :issue_relations, :workflows, |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class JournalTest < |
|
20 | class JournalTest < ActiveSupport::TestCase | |
21 | fixtures :issues, :issue_statuses, :journals, :journal_details |
|
21 | fixtures :issues, :issue_statuses, :journals, :journal_details | |
22 |
|
22 | |||
23 | def setup |
|
23 | def setup |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../../../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../../../test_helper' | |
19 |
|
19 | |||
20 |
class Redmine::AccessControlTest < |
|
20 | class Redmine::AccessControlTest < ActiveSupport::TestCase | |
21 |
|
21 | |||
22 | def setup |
|
22 | def setup | |
23 | @access_module = Redmine::AccessControl |
|
23 | @access_module = Redmine::AccessControl |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../../../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../../../test_helper' | |
19 |
|
19 | |||
20 |
class Redmine::Hook::ManagerTest < |
|
20 | class Redmine::Hook::ManagerTest < ActiveSupport::TestCase | |
21 |
|
21 | |||
22 | fixtures :issues |
|
22 | fixtures :issues | |
23 |
|
23 |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../../../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../../../test_helper' | |
19 |
|
19 | |||
20 |
class Redmine::I18nTest < |
|
20 | class Redmine::I18nTest < ActiveSupport::TestCase | |
21 | include Redmine::I18n |
|
21 | include Redmine::I18n | |
22 |
|
22 | |||
23 | def setup |
|
23 | def setup |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../../../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../../../test_helper' | |
19 |
|
19 | |||
20 |
class Redmine::MimeTypeTest < |
|
20 | class Redmine::MimeTypeTest < ActiveSupport::TestCase | |
21 |
|
21 | |||
22 | def test_of |
|
22 | def test_of | |
23 | to_test = {'test.unk' => nil, |
|
23 | to_test = {'test.unk' => nil, |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../../../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../../../test_helper' | |
19 |
|
19 | |||
20 |
class Redmine::PluginTest < |
|
20 | class Redmine::PluginTest < ActiveSupport::TestCase | |
21 |
|
21 | |||
22 | def setup |
|
22 | def setup | |
23 | @klass = Redmine::Plugin |
|
23 | @klass = Redmine::Plugin |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../../../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../../../test_helper' | |
19 |
|
19 | |||
20 |
class Redmine::UnifiedDiffTest < |
|
20 | class Redmine::UnifiedDiffTest < ActiveSupport::TestCase | |
21 |
|
21 | |||
22 | def setup |
|
22 | def setup | |
23 | end |
|
23 | end |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class MailHandlerTest < |
|
20 | class MailHandlerTest < ActiveSupport::TestCase | |
21 | fixtures :users, :projects, |
|
21 | fixtures :users, :projects, | |
22 | :enabled_modules, |
|
22 | :enabled_modules, | |
23 | :roles, |
|
23 | :roles, |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class MailerTest < |
|
20 | class MailerTest < ActiveSupport::TestCase | |
21 | include Redmine::I18n |
|
21 | include Redmine::I18n | |
22 | fixtures :projects, :issues, :users, :members, :member_roles, :documents, :attachments, :news, :tokens, :journals, :journal_details, :changesets, :trackers, :issue_statuses, :enumerations, :messages, :boards, :repositories |
|
22 | fixtures :projects, :issues, :users, :members, :member_roles, :documents, :attachments, :news, :tokens, :journals, :journal_details, :changesets, :trackers, :issue_statuses, :enumerations, :messages, :boards, :repositories | |
23 |
|
23 | |||
@@ -103,9 +103,19 class MailerTest < Test::Unit::TestCase | |||||
103 | journal = Journal.find(2) |
|
103 | journal = Journal.find(2) | |
104 | Mailer.deliver_issue_edit(journal) |
|
104 | Mailer.deliver_issue_edit(journal) | |
105 | mail = ActionMailer::Base.deliveries.last |
|
105 | mail = ActionMailer::Base.deliveries.last | |
106 | assert !mail.body.include?('<a href="https://mydomain.foo/issues/1">Bug #1: Can\'t print recipes</a>') |
|
106 | assert_equal 1, mail.parts.size | |
|
107 | assert !mail.encoded.include?('href') | |||
107 | end |
|
108 | end | |
108 |
|
109 | |||
|
110 | def test_html_mail | |||
|
111 | Setting.plain_text_mail = 0 | |||
|
112 | journal = Journal.find(2) | |||
|
113 | Mailer.deliver_issue_edit(journal) | |||
|
114 | mail = ActionMailer::Base.deliveries.last | |||
|
115 | assert_equal 2, mail.parts.size | |||
|
116 | assert mail.encoded.include?('href') | |||
|
117 | end | |||
|
118 | ||||
109 | def test_issue_add_message_id |
|
119 | def test_issue_add_message_id | |
110 | ActionMailer::Base.deliveries.clear |
|
120 | ActionMailer::Base.deliveries.clear | |
111 | issue = Issue.find(1) |
|
121 | issue = Issue.find(1) |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class MemberTest < |
|
20 | class MemberTest < ActiveSupport::TestCase | |
21 | fixtures :users, :projects, :roles, :members, :member_roles |
|
21 | fixtures :users, :projects, :roles, :members, :member_roles | |
22 |
|
22 | |||
23 | def setup |
|
23 | def setup |
@@ -2,7 +2,7 require File.dirname(__FILE__) + '/../test_helper' | |||||
2 | begin |
|
2 | begin | |
3 | require 'mocha' |
|
3 | require 'mocha' | |
4 |
|
4 | |||
5 |
class MercurialAdapterTest < |
|
5 | class MercurialAdapterTest < ActiveSupport::TestCase | |
6 |
|
6 | |||
7 | TEMPLATES_DIR = Redmine::Scm::Adapters::MercurialAdapter::TEMPLATES_DIR |
|
7 | TEMPLATES_DIR = Redmine::Scm::Adapters::MercurialAdapter::TEMPLATES_DIR | |
8 | TEMPLATE_NAME = Redmine::Scm::Adapters::MercurialAdapter::TEMPLATE_NAME |
|
8 | TEMPLATE_NAME = Redmine::Scm::Adapters::MercurialAdapter::TEMPLATE_NAME |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class MessageTest < |
|
20 | class MessageTest < ActiveSupport::TestCase | |
21 | fixtures :projects, :roles, :members, :member_roles, :boards, :messages, :users, :watchers |
|
21 | fixtures :projects, :roles, :members, :member_roles, :boards, :messages, :users, :watchers | |
22 |
|
22 | |||
23 | def setup |
|
23 | def setup |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class NewsTest < |
|
20 | class NewsTest < ActiveSupport::TestCase | |
21 | fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :news |
|
21 | fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :news | |
22 |
|
22 | |||
23 | def valid_news |
|
23 | def valid_news |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class ProjectTest < |
|
20 | class ProjectTest < ActiveSupport::TestCase | |
21 | fixtures :projects, :enabled_modules, |
|
21 | fixtures :projects, :enabled_modules, | |
22 | :issues, :issue_statuses, :journals, :journal_details, |
|
22 | :issues, :issue_statuses, :journals, :journal_details, | |
23 | :users, :members, :member_roles, :roles, :projects_trackers, :trackers, :boards, |
|
23 | :users, :members, :member_roles, :roles, :projects_trackers, :trackers, :boards, |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class QueryTest < |
|
20 | class QueryTest < ActiveSupport::TestCase | |
21 | fixtures :projects, :enabled_modules, :users, :members, :member_roles, :roles, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :watchers, :custom_fields, :custom_values, :versions, :queries |
|
21 | fixtures :projects, :enabled_modules, :users, :members, :member_roles, :roles, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :watchers, :custom_fields, :custom_values, :versions, :queries | |
22 |
|
22 | |||
23 | def test_custom_fields_for_all_projects_should_be_available_in_global_queries |
|
23 | def test_custom_fields_for_all_projects_should_be_available_in_global_queries |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class RepositoryBazaarTest < |
|
20 | class RepositoryBazaarTest < ActiveSupport::TestCase | |
21 | fixtures :projects |
|
21 | fixtures :projects | |
22 |
|
22 | |||
23 | # No '..' in the repository path |
|
23 | # No '..' in the repository path |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 | require 'pp' |
|
19 | require 'pp' | |
20 |
class RepositoryCvsTest < |
|
20 | class RepositoryCvsTest < ActiveSupport::TestCase | |
21 | fixtures :projects |
|
21 | fixtures :projects | |
22 |
|
22 | |||
23 | # No '..' in the repository path |
|
23 | # No '..' in the repository path |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class RepositoryDarcsTest < |
|
20 | class RepositoryDarcsTest < ActiveSupport::TestCase | |
21 | fixtures :projects |
|
21 | fixtures :projects | |
22 |
|
22 | |||
23 | # No '..' in the repository path |
|
23 | # No '..' in the repository path |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class RepositoryFilesystemTest < |
|
20 | class RepositoryFilesystemTest < ActiveSupport::TestCase | |
21 | fixtures :projects |
|
21 | fixtures :projects | |
22 |
|
22 | |||
23 | # No '..' in the repository path |
|
23 | # No '..' in the repository path |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class RepositoryGitTest < |
|
20 | class RepositoryGitTest < ActiveSupport::TestCase | |
21 | fixtures :projects |
|
21 | fixtures :projects | |
22 |
|
22 | |||
23 | # No '..' in the repository path |
|
23 | # No '..' in the repository path |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class RepositoryMercurialTest < |
|
20 | class RepositoryMercurialTest < ActiveSupport::TestCase | |
21 | fixtures :projects |
|
21 | fixtures :projects | |
22 |
|
22 | |||
23 | # No '..' in the repository path |
|
23 | # No '..' in the repository path |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class RepositorySubversionTest < |
|
20 | class RepositorySubversionTest < ActiveSupport::TestCase | |
21 | fixtures :projects |
|
21 | fixtures :projects | |
22 |
|
22 | |||
23 | # No '..' in the repository path for svn |
|
23 | # No '..' in the repository path for svn |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class RepositoryTest < |
|
20 | class RepositoryTest < ActiveSupport::TestCase | |
21 | fixtures :projects, |
|
21 | fixtures :projects, | |
22 | :trackers, |
|
22 | :trackers, | |
23 | :projects_trackers, |
|
23 | :projects_trackers, |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class RoleTest < |
|
20 | class RoleTest < ActiveSupport::TestCase | |
21 | fixtures :roles, :workflows |
|
21 | fixtures :roles, :workflows | |
22 |
|
22 | |||
23 | def test_copy_workflows |
|
23 | def test_copy_workflows |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class SearchTest < |
|
20 | class SearchTest < ActiveSupport::TestCase | |
21 | fixtures :users, |
|
21 | fixtures :users, | |
22 | :members, |
|
22 | :members, | |
23 | :member_roles, |
|
23 | :member_roles, |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class SettingTest < |
|
20 | class SettingTest < ActiveSupport::TestCase | |
21 |
|
21 | |||
22 | def test_read_default |
|
22 | def test_read_default | |
23 | assert_equal "Redmine", Setting.app_title |
|
23 | assert_equal "Redmine", Setting.app_title |
@@ -19,7 +19,7 require 'mkmf' | |||||
19 |
|
19 | |||
20 | require File.dirname(__FILE__) + '/../test_helper' |
|
20 | require File.dirname(__FILE__) + '/../test_helper' | |
21 |
|
21 | |||
22 |
class SubversionAdapterTest < |
|
22 | class SubversionAdapterTest < ActiveSupport::TestCase | |
23 |
|
23 | |||
24 | if find_executable0('svn') |
|
24 | if find_executable0('svn') | |
25 | def test_client_version |
|
25 | def test_client_version |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class TimeEntryActivityTest < |
|
20 | class TimeEntryActivityTest < ActiveSupport::TestCase | |
21 | fixtures :enumerations, :time_entries |
|
21 | fixtures :enumerations, :time_entries | |
22 |
|
22 | |||
23 | def test_should_be_an_enumeration |
|
23 | def test_should_be_an_enumeration |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class TimeEntryTest < |
|
20 | class TimeEntryTest < ActiveSupport::TestCase | |
21 | fixtures :issues, :projects, :users, :time_entries |
|
21 | fixtures :issues, :projects, :users, :time_entries | |
22 |
|
22 | |||
23 | def test_hours_format |
|
23 | def test_hours_format |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class TokenTest < |
|
20 | class TokenTest < ActiveSupport::TestCase | |
21 | fixtures :tokens |
|
21 | fixtures :tokens | |
22 |
|
22 | |||
23 | def test_create |
|
23 | def test_create |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class TrackerTest < |
|
20 | class TrackerTest < ActiveSupport::TestCase | |
21 | fixtures :trackers, :workflows |
|
21 | fixtures :trackers, :workflows | |
22 |
|
22 | |||
23 | def test_copy_workflows |
|
23 | def test_copy_workflows |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class UserPreferenceTest < |
|
20 | class UserPreferenceTest < ActiveSupport::TestCase | |
21 | fixtures :users, :user_preferences |
|
21 | fixtures :users, :user_preferences | |
22 |
|
22 | |||
23 | def test_create |
|
23 | def test_create |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class UserTest < |
|
20 | class UserTest < ActiveSupport::TestCase | |
21 | fixtures :users, :members, :projects, :roles, :member_roles |
|
21 | fixtures :users, :members, :projects, :roles, :member_roles | |
22 |
|
22 | |||
23 | def setup |
|
23 | def setup |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class VersionTest < |
|
20 | class VersionTest < ActiveSupport::TestCase | |
21 | fixtures :projects, :users, :issues, :issue_statuses, :trackers, :enumerations, :versions |
|
21 | fixtures :projects, :users, :issues, :issue_statuses, :trackers, :enumerations, :versions | |
22 |
|
22 | |||
23 | def setup |
|
23 | def setup |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class WatcherTest < |
|
20 | class WatcherTest < ActiveSupport::TestCase | |
21 | fixtures :issues, :users |
|
21 | fixtures :issues, :users | |
22 |
|
22 | |||
23 | def setup |
|
23 | def setup |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class WikiContentTest < |
|
20 | class WikiContentTest < ActiveSupport::TestCase | |
21 | fixtures :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions, :users |
|
21 | fixtures :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions, :users | |
22 |
|
22 | |||
23 | def setup |
|
23 | def setup |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class WikiPageTest < |
|
20 | class WikiPageTest < ActiveSupport::TestCase | |
21 | fixtures :projects, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions |
|
21 | fixtures :projects, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions | |
22 |
|
22 | |||
23 | def setup |
|
23 | def setup |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class WikiRedirectTest < |
|
20 | class WikiRedirectTest < ActiveSupport::TestCase | |
21 | fixtures :projects, :wikis |
|
21 | fixtures :projects, :wikis | |
22 |
|
22 | |||
23 | def setup |
|
23 | def setup |
@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 |
class WikiTest < |
|
20 | class WikiTest < ActiveSupport::TestCase | |
21 | fixtures :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions |
|
21 | fixtures :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions | |
22 |
|
22 | |||
23 | def test_create |
|
23 | def test_create |
@@ -172,16 +172,29 namespace :test do | |||||
172 |
|
172 | |||
173 | desc 'Update the plugin and tests files in the test application from the plugin' |
|
173 | desc 'Update the plugin and tests files in the test application from the plugin' | |
174 | task :mirror_engine_files => [:test_app, :copy_engines_plugin] do |
|
174 | task :mirror_engine_files => [:test_app, :copy_engines_plugin] do | |
175 | puts "> Modifying default config files to load engines plugin" |
|
175 | puts "> Tweaking generated application to be suitable for testing" | |
|
176 | ||||
|
177 | # Replace the Rails plugin loader with the engines one. | |||
176 | insert_line("require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')", |
|
178 | insert_line("require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')", | |
177 | :into => 'config/environment.rb', |
|
179 | :into => 'config/environment.rb', | |
178 | :after => "require File.join(File.dirname(__FILE__), 'boot')") |
|
180 | :after => "require File.join(File.dirname(__FILE__), 'boot')") | |
179 |
|
181 | |||
180 | insert_line('map.from_plugin :test_routing', :into => 'config/routes.rb', |
|
182 | # Add the engines test helper to handle fixtures & stuff. | |
181 | :after => /\AActionController::Routing::Routes/) |
|
|||
182 |
|
||||
183 | insert_line("require 'engines_test_helper'", :into => 'test/test_helper.rb') |
|
183 | insert_line("require 'engines_test_helper'", :into => 'test/test_helper.rb') | |
184 |
|
184 | |||
|
185 | # Run engine plugin tests when running the application | |||
|
186 | insert_line("task :test => ['test:engines:all']", :into => 'Rakefile') | |||
|
187 | ||||
|
188 | # We want exceptions to be raised | |||
|
189 | insert_line("def rescue_action(e) raise e end;", | |||
|
190 | :into => "app/controllers/application_controller.rb", | |||
|
191 | :after => "class ApplicationController < ActionController::Base") | |||
|
192 | ||||
|
193 | # We need this method to test where actions are being rendered from. | |||
|
194 | insert_line("include RenderInformation", | |||
|
195 | :into => "app/controllers/application_controller.rb", | |||
|
196 | :after => "class ApplicationController < ActionController::Base") | |||
|
197 | ||||
185 | puts "> Mirroring test application files into #{test_app_dir}" |
|
198 | puts "> Mirroring test application files into #{test_app_dir}" | |
186 | mirror_test_files('app') |
|
199 | mirror_test_files('app') | |
187 | mirror_test_files('lib') |
|
200 | mirror_test_files('lib') |
@@ -4,4 +4,4 homepage: http://www.rails-engines.org | |||||
4 | summary: Enhances the plugin mechanism to perform more flexible sharing |
|
4 | summary: Enhances the plugin mechanism to perform more flexible sharing | |
5 | description: The Rails Engines plugin allows the sharing of almost any type of code or asset that you could use in a Rails application, including controllers, models, stylesheets, and views. |
|
5 | description: The Rails Engines plugin allows the sharing of almost any type of code or asset that you could use in a Rails application, including controllers, models, stylesheets, and views. | |
6 | license: MIT |
|
6 | license: MIT | |
7 |
version: 2. |
|
7 | version: 2.3.2 No newline at end of file |
@@ -1,7 +1,7 | |||||
1 | begin |
|
1 | begin | |
2 | require 'rails/version' |
|
2 | require 'rails/version' | |
3 |
unless Rails::VERSION::MAJOR >= 2 && Rails::VERSION::MINOR >= |
|
3 | unless Rails::VERSION::MAJOR >= 2 && Rails::VERSION::MINOR >= 3 && Rails::VERSION::TINY >= 2 | |
4 |
raise "This version of the engines plugin requires Rails 2. |
|
4 | raise "This version of the engines plugin requires Rails 2.3.2 or later!" | |
5 | end |
|
5 | end | |
6 | end |
|
6 | end | |
7 |
|
7 |
@@ -1,5 +1,5 | |||||
1 | # Only call Engines.init once, in the after_initialize block so that Rails |
|
1 | # Only call Engines.init once, in the after_initialize block so that Rails | |
2 | # plugin reloading works when turned on |
|
2 | # plugin reloading works when turned on | |
3 | config.after_initialize do |
|
3 | config.after_initialize do | |
4 | Engines.init if defined? :Engines |
|
4 | Engines.init(initializer) if defined? :Engines | |
5 |
end |
|
5 | end No newline at end of file |
@@ -43,7 +43,7 module Engines | |||||
43 |
|
43 | |||
44 | # List of extensions to load, can be changed in init.rb before calling Engines.init |
|
44 | # List of extensions to load, can be changed in init.rb before calling Engines.init | |
45 | mattr_accessor :rails_extensions |
|
45 | mattr_accessor :rails_extensions | |
46 |
self.rails_extensions = %w( |
|
46 | self.rails_extensions = %w(asset_helpers form_tag_helpers migrations dependencies) | |
47 |
|
47 | |||
48 | # The name of the public directory to mirror public engine assets into. |
|
48 | # The name of the public directory to mirror public engine assets into. | |
49 | # Defaults to <tt>RAILS_ROOT/public/plugin_assets</tt>. |
|
49 | # Defaults to <tt>RAILS_ROOT/public/plugin_assets</tt>. | |
@@ -68,7 +68,7 module Engines | |||||
68 | mattr_accessor :disable_application_code_loading |
|
68 | mattr_accessor :disable_application_code_loading | |
69 | self.disable_application_code_loading = false |
|
69 | self.disable_application_code_loading = false | |
70 |
|
70 | |||
71 |
# Set this t |
|
71 | # Set this to true if code should not be mixed (i.e. it will be loaded | |
72 | # from the first valid path on $LOAD_PATH) |
|
72 | # from the first valid path on $LOAD_PATH) | |
73 | mattr_accessor :disable_code_mixing |
|
73 | mattr_accessor :disable_code_mixing | |
74 | self.disable_code_mixing = false |
|
74 | self.disable_code_mixing = false | |
@@ -81,7 +81,7 module Engines | |||||
81 | self.code_mixing_file_types = %w(controller helper) |
|
81 | self.code_mixing_file_types = %w(controller helper) | |
82 |
|
82 | |||
83 | class << self |
|
83 | class << self | |
84 | def init |
|
84 | def init(initializer) | |
85 | load_extensions |
|
85 | load_extensions | |
86 | Engines::Assets.initialize_base_public_directory |
|
86 | Engines::Assets.initialize_base_public_directory | |
87 | end |
|
87 | end | |
@@ -124,9 +124,9 module Engines | |||||
124 | # and that they are placed within plugin/app/things (the pluralized form of 'thing'). |
|
124 | # and that they are placed within plugin/app/things (the pluralized form of 'thing'). | |
125 | # |
|
125 | # | |
126 | # It's important to note that you'll also want to ensure that the "things" are |
|
126 | # It's important to note that you'll also want to ensure that the "things" are | |
127 |
# on your load path |
|
127 | # on your load path by including them in Rails load path mechanism, e.g. in init.rb: | |
128 | # |
|
128 | # | |
129 | # Rails.plugins[:my_plugin].code_paths << "app/things" |
|
129 | # ActiveSupport::Dependencies.load_paths << File.join(File.dirname(__FILE__), 'app', 'things')) | |
130 | # |
|
130 | # | |
131 | def mix_code_from(*types) |
|
131 | def mix_code_from(*types) | |
132 | self.code_mixing_file_types += types.map { |x| x.to_s.singularize } |
|
132 | self.code_mixing_file_types += types.map { |x| x.to_s.singularize } |
@@ -4,23 +4,9 | |||||
4 | # |
|
4 | # | |
5 | # Engines.plugins[:plugin_name] |
|
5 | # Engines.plugins[:plugin_name] | |
6 | # |
|
6 | # | |
7 | # If this plugin contains paths in directories other than <tt>app/controllers</tt>, |
|
|||
8 | # <tt>app/helpers</tt>, <tt>app/models</tt> and <tt>components</tt>, authors can |
|
|||
9 | # declare this by adding extra paths to #code_paths: |
|
|||
10 | # |
|
|||
11 | # Rails.plugin[:my_plugin].code_paths << "app/sweepers" << "vendor/my_lib" |
|
|||
12 | # |
|
|||
13 | # Other properties of the Plugin instance can also be set. |
|
7 | # Other properties of the Plugin instance can also be set. | |
14 | module Engines |
|
8 | module Engines | |
15 | class Plugin < Rails::Plugin |
|
9 | class Plugin < Rails::Plugin | |
16 | # Plugins can add code paths to this attribute in init.rb if they |
|
|||
17 | # need plugin directories to be added to the load path, i.e. |
|
|||
18 | # |
|
|||
19 | # plugin.code_paths << 'app/other_classes' |
|
|||
20 | # |
|
|||
21 | # Defaults to ["app/controllers", "app/helpers", "app/models", "components"] |
|
|||
22 | attr_accessor :code_paths |
|
|||
23 |
|
||||
24 | # Plugins can add paths to this attribute in init.rb if they need |
|
10 | # Plugins can add paths to this attribute in init.rb if they need | |
25 | # controllers loaded from additional locations. |
|
11 | # controllers loaded from additional locations. | |
26 | attr_accessor :controller_paths |
|
12 | attr_accessor :controller_paths | |
@@ -32,16 +18,6 module Engines | |||||
32 | attr_accessor :public_directory |
|
18 | attr_accessor :public_directory | |
33 |
|
19 | |||
34 | protected |
|
20 | protected | |
35 |
|
||||
36 | # The default set of code paths which will be added to $LOAD_PATH |
|
|||
37 | # and Dependencies.load_paths |
|
|||
38 | def default_code_paths |
|
|||
39 | # lib will actually be removed from the load paths when we call |
|
|||
40 | # uniq! in #inject_into_load_paths, but it's important to keep it |
|
|||
41 | # around (for the documentation tasks, for instance). |
|
|||
42 | %w(app/controllers app/helpers app/models components lib) |
|
|||
43 | end |
|
|||
44 |
|
||||
45 | # The default set of code paths which will be added to the routing system |
|
21 | # The default set of code paths which will be added to the routing system | |
46 | def default_controller_paths |
|
22 | def default_controller_paths | |
47 | %w(app/controllers components) |
|
23 | %w(app/controllers components) | |
@@ -58,41 +34,23 module Engines | |||||
58 |
|
34 | |||
59 | def initialize(directory) |
|
35 | def initialize(directory) | |
60 | super directory |
|
36 | super directory | |
61 | @code_paths = default_code_paths |
|
|||
62 | @controller_paths = default_controller_paths |
|
37 | @controller_paths = default_controller_paths | |
63 | @public_directory = default_public_directory |
|
38 | @public_directory = default_public_directory | |
64 | end |
|
39 | end | |
65 |
|
40 | |||
66 | # Returns a list of paths this plugin wishes to make available in $LOAD_PATH |
|
|||
67 | # |
|
|||
68 | # Overwrites the correspondend method in the superclass |
|
|||
69 | def load_paths |
|
|||
70 | report_nonexistant_or_empty_plugin! unless valid? |
|
|||
71 | select_existing_paths :code_paths |
|
|||
72 | end |
|
|||
73 |
|
||||
74 | # Extends the superclass' load method to additionally mirror public assets |
|
41 | # Extends the superclass' load method to additionally mirror public assets | |
75 | def load(initializer) |
|
42 | def load(initializer) | |
76 | return if loaded? |
|
43 | return if loaded? | |
77 | super initializer |
|
44 | super initializer | |
78 | add_plugin_view_paths |
|
|||
79 | add_plugin_locale_paths |
|
45 | add_plugin_locale_paths | |
80 | Assets.mirror_files_for(self) |
|
46 | Assets.mirror_files_for(self) | |
81 | end |
|
47 | end | |
82 |
|
48 | |||
83 | # for code_paths and controller_paths select those paths that actually |
|
49 | # select those paths that actually exist in the plugin's directory | |
84 | # exist in the plugin's directory |
|
|||
85 | def select_existing_paths(name) |
|
50 | def select_existing_paths(name) | |
86 | Engines.select_existing_paths(self.send(name).map { |p| File.join(directory, p) }) |
|
51 | Engines.select_existing_paths(self.send(name).map { |p| File.join(directory, p) }) | |
87 | end |
|
52 | end | |
88 |
|
53 | |||
89 | def add_plugin_view_paths |
|
|||
90 | view_path = File.join(directory, 'app', 'views') |
|
|||
91 | if File.exist?(view_path) |
|
|||
92 | ActionController::Base.prepend_view_path(view_path) # push it just underneath the app |
|
|||
93 | end |
|
|||
94 | end |
|
|||
95 |
|
||||
96 | def add_plugin_locale_paths |
|
54 | def add_plugin_locale_paths | |
97 | locale_path = File.join(directory, 'locales') |
|
55 | locale_path = File.join(directory, 'locales') | |
98 | return unless File.exists?(locale_path) |
|
56 | return unless File.exists?(locale_path) | |
@@ -112,11 +70,6 module Engines | |||||
112 | "#{File.basename(Engines.public_directory)}/#{name}" |
|
70 | "#{File.basename(Engines.public_directory)}/#{name}" | |
113 | end |
|
71 | end | |
114 |
|
72 | |||
115 | # The path to this plugin's routes file |
|
|||
116 | def routes_path |
|
|||
117 | File.join(directory, "routes.rb") |
|
|||
118 | end |
|
|||
119 |
|
||||
120 | # The directory containing this plugin's migrations (<tt>plugin/db/migrate</tt>) |
|
73 | # The directory containing this plugin's migrations (<tt>plugin/db/migrate</tt>) | |
121 | def migration_directory |
|
74 | def migration_directory | |
122 | File.join(self.directory, 'db', 'migrate') |
|
75 | File.join(self.directory, 'db', 'migrate') |
@@ -5,14 +5,7 module Engines | |||||
5 | def register_plugin_as_loaded(plugin) |
|
5 | def register_plugin_as_loaded(plugin) | |
6 | super plugin |
|
6 | super plugin | |
7 | Engines.plugins << plugin |
|
7 | Engines.plugins << plugin | |
8 | register_to_routing(plugin) |
|
|||
9 | end |
|
8 | end | |
10 |
|
||||
11 | # Registers the plugin's controller_paths for the routing system. |
|
|||
12 | def register_to_routing(plugin) |
|
|||
13 | initializer.configuration.controller_paths += plugin.select_existing_paths(:controller_paths) |
|
|||
14 | initializer.configuration.controller_paths.uniq! |
|
|||
15 | end |
|
|||
16 | end |
|
9 | end | |
17 | end |
|
10 | end | |
18 | end No newline at end of file |
|
11 | end |
@@ -67,10 +67,14 module Engines::Testing | |||||
67 | # This method is called by the engines-supplied plugin testing rake tasks |
|
67 | # This method is called by the engines-supplied plugin testing rake tasks | |
68 | def self.setup_plugin_fixtures(plugins = Engines.plugins.by_precedence) |
|
68 | def self.setup_plugin_fixtures(plugins = Engines.plugins.by_precedence) | |
69 |
|
69 | |||
|
70 | # First, clear the directory | |||
|
71 | Dir.glob("#{self.temporary_fixtures_directory}/*.yml").each{|fixture| File.delete(fixture)} | |||
|
72 | ||||
70 | # Copy all plugin fixtures, and then the application fixtures, into this directory |
|
73 | # Copy all plugin fixtures, and then the application fixtures, into this directory | |
71 | plugins.each do |plugin| |
|
74 | plugins.each do |plugin| | |
72 | plugin_fixtures_directory = File.join(plugin.directory, "test", "fixtures") |
|
75 | plugin_fixtures_directory = File.join(plugin.directory, "test", "fixtures") | |
73 | if File.directory?(plugin_fixtures_directory) |
|
76 | plugin_app_directory = File.join(plugin.directory, "app") | |
|
77 | if File.directory?(plugin_app_directory) && File.directory?(plugin_fixtures_directory) | |||
74 | Engines.mirror_files_from(plugin_fixtures_directory, self.temporary_fixtures_directory) |
|
78 | Engines.mirror_files_from(plugin_fixtures_directory, self.temporary_fixtures_directory) | |
75 | end |
|
79 | end | |
76 | end |
|
80 | end | |
@@ -84,4 +88,14 module Engines::Testing | |||||
84 | ActiveSupport::TestCase.fixture_path = self.temporary_fixtures_directory |
|
88 | ActiveSupport::TestCase.fixture_path = self.temporary_fixtures_directory | |
85 | $LOAD_PATH.unshift self.temporary_fixtures_directory |
|
89 | $LOAD_PATH.unshift self.temporary_fixtures_directory | |
86 | end |
|
90 | end | |
|
91 | ||||
|
92 | # overridden test should be in test/{unit,functional,integration}/{plugin_name}/{test_name} | |||
|
93 | def self.override_tests_from_app | |||
|
94 | filename = caller.first.split(":").first | |||
|
95 | plugin_name = filename.split("/")[-4] | |||
|
96 | test_kind = filename.split("/")[-2] | |||
|
97 | override_file = File.expand_path(File.join(File.dirname(filename), "..", "..", "..", "..", "..", "test", | |||
|
98 | test_kind, plugin_name, File.basename(filename))) | |||
|
99 | load(override_file) if File.exist?(override_file) | |||
|
100 | end | |||
87 | end No newline at end of file |
|
101 | end |
@@ -118,10 +118,10 namespace :db do | |||||
118 | end |
|
118 | end | |
119 |
|
119 | |||
120 | desc 'Migrate a specified plugin.' |
|
120 | desc 'Migrate a specified plugin.' | |
121 |
task( |
|
121 | task(:plugin => :environment) do | |
122 |
name = |
|
122 | name = ENV['NAME'] | |
123 | if plugin = Engines.plugins[name] |
|
123 | if plugin = Engines.plugins[name] | |
124 |
version = |
|
124 | version = ENV['VERSION'] | |
125 | puts "Migrating #{plugin.name} to " + (version ? "version #{version}" : 'latest version') + " ..." |
|
125 | puts "Migrating #{plugin.name} to " + (version ? "version #{version}" : 'latest version') + " ..." | |
126 | plugin.migrate(version ? version.to_i : nil) |
|
126 | plugin.migrate(version ? version.to_i : nil) | |
127 | else |
|
127 | else | |
@@ -152,8 +152,8 end | |||||
152 |
|
152 | |||
153 | # this is just a modification of the original task in railties/lib/tasks/documentation.rake, |
|
153 | # this is just a modification of the original task in railties/lib/tasks/documentation.rake, | |
154 | # because the default task doesn't support subdirectories like <plugin>/app or |
|
154 | # because the default task doesn't support subdirectories like <plugin>/app or | |
155 |
# <plugin>/component. These tasks now include every file under a plugin's |
|
155 | # <plugin>/component. These tasks now include every file under a plugin's load paths (see | |
156 |
# Plugin# |
|
156 | # Plugin#load_paths). | |
157 | namespace :doc do |
|
157 | namespace :doc do | |
158 |
|
158 | |||
159 | plugins = FileList['vendor/plugins/**'].collect { |plugin| File.basename(plugin) } |
|
159 | plugins = FileList['vendor/plugins/**'].collect { |plugin| File.basename(plugin) } | |
@@ -172,9 +172,9 namespace :doc do | |||||
172 | options << '--line-numbers' << '--inline-source' |
|
172 | options << '--line-numbers' << '--inline-source' | |
173 | options << '-T html' |
|
173 | options << '-T html' | |
174 |
|
174 | |||
175 |
# Include every file in the plugin's |
|
175 | # Include every file in the plugin's load_paths (see Plugin#load_paths) | |
176 | if Engines.plugins[plugin] |
|
176 | if Engines.plugins[plugin] | |
177 |
files.include("#{plugin_base}/{#{Engines.plugins[plugin]. |
|
177 | files.include("#{plugin_base}/{#{Engines.plugins[plugin].load_paths.join(",")}}/**/*.rb") | |
178 | end |
|
178 | end | |
179 | if File.exists?("#{plugin_base}/README") |
|
179 | if File.exists?("#{plugin_base}/README") | |
180 | files.include("#{plugin_base}/README") |
|
180 | files.include("#{plugin_base}/README") | |
@@ -217,6 +217,34 Report any issues on http://dev.rails-engines.org. Thanks! | |||||
217 | -~===============( ... as you were ... )============================~-} |
|
217 | -~===============( ... as you were ... )============================~-} | |
218 | end |
|
218 | end | |
219 |
|
219 | |||
|
220 | namespace :engines do | |||
|
221 | ||||
|
222 | def engine_plugins | |||
|
223 | Dir["vendor/plugins/*"].select { |f| File.directory?(File.join(f, "app")) }.map { |f| File.basename(f) }.join(",") | |||
|
224 | end | |||
|
225 | ||||
|
226 | desc "Run tests from within engines plugins (plugins with an 'app' directory)" | |||
|
227 | task :all => [:units, :functionals, :integration] | |||
|
228 | ||||
|
229 | desc "Run unit tests from within engines plugins (plugins with an 'app' directory)" | |||
|
230 | Rake::TestTask.new(:units => "test:plugins:setup_plugin_fixtures") do |t| | |||
|
231 | t.pattern = "vendor/plugins/{#{ENV['PLUGIN'] || engine_plugins}}/test/unit/**/*_test.rb" | |||
|
232 | t.verbose = true | |||
|
233 | end | |||
|
234 | ||||
|
235 | desc "Run functional tests from within engines plugins (plugins with an 'app' directory)" | |||
|
236 | Rake::TestTask.new(:functionals => "test:plugins:setup_plugin_fixtures") do |t| | |||
|
237 | t.pattern = "vendor/plugins/{#{ENV['PLUGIN'] || engine_plugins}}/test/functional/**/*_test.rb" | |||
|
238 | t.verbose = true | |||
|
239 | end | |||
|
240 | ||||
|
241 | desc "Run integration tests from within engines plugins (plugins with an 'app' directory)" | |||
|
242 | Rake::TestTask.new(:integration => "test:plugins:setup_plugin_fixtures") do |t| | |||
|
243 | t.pattern = "vendor/plugins/{#{ENV['PLUGIN'] || engine_plugins}}/test/integration/**/*_test.rb" | |||
|
244 | t.verbose = true | |||
|
245 | end | |||
|
246 | end | |||
|
247 | ||||
220 | namespace :plugins do |
|
248 | namespace :plugins do | |
221 |
|
249 | |||
222 | desc "Run the plugin tests in vendor/plugins/**/test (or specify with PLUGIN=name)" |
|
250 | desc "Run the plugin tests in vendor/plugins/**/test (or specify with PLUGIN=name)" |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now