From 645451ed8537af4d79a8004038d466d19de11872 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Tue, 25 Dec 2012 15:11:34 -0300 Subject: [PATCH] Remove deprecated "terminology" feature --- app/controllers/application_controller.rb | 9 --------- app/models/environment.rb | 16 ---------------- lib/noosfero/terminology.rb | 27 --------------------------- test/functional/application_controller_test.rb | 11 ----------- test/unit/noosfero_test.rb | 22 ---------------------- 5 files changed, 0 insertions(+), 85 deletions(-) delete mode 100644 lib/noosfero/terminology.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d72b0e5..d972521 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -56,8 +56,6 @@ class ApplicationController < ActionController::Base attr_reader :environment - before_filter :load_terminology - # declares that the given actions cannot be accessed by other HTTP # method besides POST. def self.post_only(actions, redirect = { :action => 'index'}) @@ -127,13 +125,6 @@ class ApplicationController < ActionController::Base end end - def load_terminology - # cache terminology for performance - @@terminology_cache ||= {} - @@terminology_cache[environment.id] ||= environment.terminology - Noosfero.terminology = @@terminology_cache[environment.id] - end - def render_not_found(path = nil) @no_design_blocks = true @path ||= request.path diff --git a/app/models/environment.rb b/app/models/environment.rb index 1fcd241..12b3671 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -382,22 +382,6 @@ class Environment < ActiveRecord::Base self.settings[:organization_approval_method] = actual_value end - def terminology - if self.settings[:terminology] - self.settings[:terminology].constantize.instance - else - Noosfero.terminology - end - end - - def terminology=(value) - if value - self.settings[:terminology] = value.class.name - else - self.settings[:terminology] = nil - end - end - def custom_person_fields self.settings[:custom_person_fields].nil? ? {} : self.settings[:custom_person_fields] end diff --git a/lib/noosfero/terminology.rb b/lib/noosfero/terminology.rb deleted file mode 100644 index 609d643..0000000 --- a/lib/noosfero/terminology.rb +++ /dev/null @@ -1,27 +0,0 @@ -module Noosfero - class Terminology - - def get(x) - raise NotImplementedError - end - - # the default terminology. Just returns the same message as is. - class Default - include Singleton - def get(x) - x - end - end - - class Custom - include Singleton - def initialize(hash) - @messages = hash - end - def get(x) - @messages[x] || x - end - end - - end -end diff --git a/test/functional/application_controller_test.rb b/test/functional/application_controller_test.rb index 382ee10..4c68a34 100644 --- a/test/functional/application_controller_test.rb +++ b/test/functional/application_controller_test.rb @@ -238,17 +238,6 @@ class ApplicationControllerTest < ActionController::TestCase assert_no_tag :tag => 'div', :attributes => { :id => 'theme-test-panel' } end - should 'load terminology from environment' do - term = Zen3Terminology.instance - env = Environment.default - Environment.stubs(:default).returns(env) - env.stubs(:terminology).returns(term) - env.stubs(:id).returns(-9999) - - get :index - assert_equal Noosfero.terminology, term - end - should 'not display categories menu if categories feature disabled' do Environment.any_instance.stubs(:enabled?).with(anything).returns(true) c1 = Environment.default.categories.create!(:name => 'Category 1', :display_color => 1, :parent => nil, :display_in_menu => true ) diff --git a/test/unit/noosfero_test.rb b/test/unit/noosfero_test.rb index c7506bf..17cf908 100644 --- a/test/unit/noosfero_test.rb +++ b/test/unit/noosfero_test.rb @@ -30,15 +30,6 @@ class NoosferoTest < ActiveSupport::TestCase assert_match /^#{Noosfero.identifier_format}$/, 'with.dot' end - should 'delegate terminology' do - Noosfero.terminology.expects(:get).with('lalala').returns('lelele') - assert_equal 'lelele', Noosfero.term('lalala') - end - - should 'use default terminology by default' do - assert_equal 'lalalalala', Noosfero.term('lalalalala') - end - should 'provide url options to identify development environment' do ENV.expects(:[]).with('RAILS_ENV').returns('development') Noosfero.expects(:development_url_options).returns({ :port => 9999 }) @@ -56,19 +47,6 @@ class NoosferoTest < ActiveSupport::TestCase assert_equal 'en', FastGettext.locale end - should 'use terminology with ngettext' do - Noosfero.stubs(:terminology).returns(UnifreireTerminology.instance) - - Noosfero.with_locale('en') do - assert_equal 'One institution', n__('One enterprise', '%{num} enterprises', 1) - end - - Noosfero.with_locale('pt') do - stubs(:ngettext).with('One institution', '%{num} institutions', 1).returns('Uma instituição') - assert_equal 'Uma instituição', n__('One enterprise', '%{num} enterprises', 1) - end - end - should "use default hostname of default environment as hostname of Noosfero instance" do Environment.default.domains << Domain.new(:name => 'thisisdefaulthostname.com', :is_default => true) assert_equal 'thisisdefaulthostname.com', Noosfero.default_hostname -- libgit2 0.21.2