diff --git a/app/controllers/embed_controller.rb b/app/controllers/embed_controller.rb
index 01861b3..d5b858f 100644
--- a/app/controllers/embed_controller.rb
+++ b/app/controllers/embed_controller.rb
@@ -4,10 +4,10 @@ class EmbedController < ApplicationController
def block
@block = Block.find(params[:id])
if !@block.embedable? || !@block.visible?
- render 'unavailable.rhtml', :status => 403
+ render 'unavailable', :status => 403
end
rescue ActiveRecord::RecordNotFound
- render 'not_found.rhtml', :status => 404
+ render 'not_found', :status => 404
end
end
diff --git a/app/helpers/categories_helper.rb b/app/helpers/categories_helper.rb
index b36d919..f473a34 100644
--- a/app/helpers/categories_helper.rb
+++ b/app/helpers/categories_helper.rb
@@ -50,8 +50,9 @@ module CategoriesHelper
#FIXME make this test
def selected_category_link(cat)
- content_tag('div', button_to_function_without_text(:remove, _('Remove'), nil) {|page| page["selected-category-#{cat.id}"].remove} +
- link_to_function(cat.full_name(' → '), nil, :id => "remove-selected-category-#{cat.id}-button", :class => 'select-subcategory-link') {|page| page["selected-category-#{cat.id}"].remove},
+ js_remove = j("jQuery('#selected-category-#{cat.id}').remove();")
+ content_tag('div', button_to_function_without_text(:remove, _('Remove'), js_remove) +
+ link_to_function(cat.full_name(' → '), js_remove, :id => "remove-selected-category-#{cat.id}-button", :class => 'select-subcategory-link'),
:class => 'selected-category'
)
end
diff --git a/app/models/block.rb b/app/models/block.rb
index 32c1d79..2ccc555 100644
--- a/app/models/block.rb
+++ b/app/models/block.rb
@@ -1,6 +1,6 @@
class Block < ActiveRecord::Base
- attr_accessible :title, :display, :limit, :box_id, :posts_per_page, :visualization_format, :language
+ attr_accessible :title, :display, :limit, :box_id, :posts_per_page, :visualization_format, :language, :display_user
# to be able to generate HTML
include ActionView::Helpers::UrlHelper
@@ -24,7 +24,7 @@ class Block < ActiveRecord::Base
def embed_code
me = self
- lambda do
+ proc do
content_tag('iframe', '',
:src => url_for(:controller => 'embed', :action => 'block', :id => me.id, :only_path => false),
:frameborder => 0,
@@ -214,9 +214,9 @@ class Block < ActiveRecord::Base
def display_user_options
@display_user_options ||= {
- 'all' => __('All users'),
- 'logged' => __('Logged'),
- 'not_logged' => __('Not logged'),
+ 'all' => _('All users'),
+ 'logged' => _('Logged'),
+ 'not_logged' => _('Not logged'),
}
end
diff --git a/app/views/shared/_select_subcategories.html.erb b/app/views/shared/_select_subcategories.html.erb
index 19533c9..b02d5f7 100644
--- a/app/views/shared/_select_subcategories.html.erb
+++ b/app/views/shared/_select_subcategories.html.erb
@@ -7,7 +7,7 @@
<%= link_to_remote category.name,
{ :update => "select-categories",
:url => { :action => "update_categories", :category_id => category.id, :id => @object},
- :loaded => visual_effect(:highlight, "select-categories")
+ :loaded => j(visual_effect(:highlight, "select-categories"))
},
:class => 'select-subcategory-link',
:id => "select-category-#{category.id}-link"
diff --git a/app/views/users/_users_list.html.erb b/app/views/users/_users_list.html.erb
index 2cfa1e7..97bf13f 100644
--- a/app/views/users/_users_list.html.erb
+++ b/app/views/users/_users_list.html.erb
@@ -1,5 +1,5 @@
diff --git a/lib/noosfero/plugin.rb b/lib/noosfero/plugin.rb
index fc9ff08..bf09db8 100644
--- a/lib/noosfero/plugin.rb
+++ b/lib/noosfero/plugin.rb
@@ -18,7 +18,7 @@ class Noosfero::Plugin
def initialize!
return if !should_load
- enabled.each do |plugin_dir|
+ available_plugins.each do |plugin_dir|
plugin_name = File.basename(plugin_dir)
plugin = load_plugin(plugin_name)
load_plugin_extensions(plugin_dir)
@@ -28,7 +28,7 @@ class Noosfero::Plugin
def setup(config)
return if !should_load
- enabled.each do |dir|
+ available_plugins.each do |dir|
setup_plugin(dir, config)
end
end
@@ -102,26 +102,19 @@ class Noosfero::Plugin
end
end
- def enabled
- @enabled ||=
- begin
- plugins = Dir.glob(Rails.root.join('config', 'plugins', '*'))
- if Rails.env.test? && !plugins.include?(Rails.root.join('config', 'plugins', 'foo'))
- plugins << Rails.root.join('plugins', 'foo')
- end
- plugins.select do |entry|
- File.directory?(entry)
- end
+ def available_plugins
+ unless @available_plugins
+ path = File.join(Rails.root, 'config', 'plugins', '*')
+ @available_plugins = Dir.glob(path).select{ |i| File.directory?(i) }
+ if Rails.env.test? && !@available_plugins.include?(File.join(Rails.root, 'config', 'plugins', 'foo'))
+ @available_plugins << File.join(Rails.root, 'plugins', 'foo')
end
+ end
+ @available_plugins
end
-
def all
- @all ||= []
- end
-
- def inherited(subclass)
- all << subclass.to_s unless all.include?(subclass.to_s)
+ @all ||= available_plugins.map{ |dir| (File.basename(dir) + "_plugin").camelize }
end
def public_name
diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb
index 3198349..a5a1905 100644
--- a/test/functional/content_viewer_controller_test.rb
+++ b/test/functional/content_viewer_controller_test.rb
@@ -1356,7 +1356,7 @@ class ContentViewerControllerTest < ActionController::TestCase
should 'not count hit from bots' do
article = fast_create(Article, :profile_id => profile.id)
- assert_no_difference article, :hits do
+ assert_no_difference 'article.hits' do
@request.env['HTTP_USER_AGENT'] = 'bot'
get 'view_page', :profile => profile.identifier, :page => article.path.split('/')
@request.env['HTTP_USER_AGENT'] = 'spider'
diff --git a/test/functional/environment_design_controller_test.rb b/test/functional/environment_design_controller_test.rb
index 31d0b8e..8d774c1 100644
--- a/test/functional/environment_design_controller_test.rb
+++ b/test/functional/environment_design_controller_test.rb
@@ -373,7 +373,7 @@ class EnvironmentDesignControllerTest < ActionController::TestCase
should 'clone a block' do
login_as(create_admin_user(Environment.default))
block = TagsBlock.create!
- assert_difference TagsBlock, :count, 1 do
+ assert_difference 'TagsBlock.count', 1 do
post :clone_block, :id => block.id
assert_response :redirect
end
diff --git a/test/functional/events_controller_test.rb b/test/functional/events_controller_test.rb
index 1cd27fb..479317e 100644
--- a/test/functional/events_controller_test.rb
+++ b/test/functional/events_controller_test.rb
@@ -43,7 +43,7 @@ class EventsControllerTest < ActionController::TestCase
profile.events << Event.new(:name => "Lesson #{i}", :start_date => Date.today)
end
get :events, :profile => profile.identifier
- assert_equal 20, assigns(:events).count
+ assert_equal 20, assigns(:events).size
end
should 'show events of specific day' do
diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb
index bad061e..83a407a 100644
--- a/test/functional/search_controller_test.rb
+++ b/test/functional/search_controller_test.rb
@@ -382,7 +382,7 @@ class SearchControllerTest < ActionController::TestCase
create_event(person, :name => "Event #{i}", :start_date => Date.today)
end
get :events
- assert_equal 20, assigns(:events).count
+ assert_equal 20, assigns(:events).size
end
%w[ people enterprises articles events communities products ].each do |asset|
@@ -564,9 +564,9 @@ class SearchControllerTest < ActionController::TestCase
c2 = create(Community, :name => 'Testing community 2')
c3 = create(Community, :name => 'Testing community 3')
ActionTracker::Record.delete_all
- ActionTracker::Record.create!(:target => c1, :user => person, :created_at => Time.now, :verb => 'leave_scrap')
- ActionTracker::Record.create!(:target => c2, :user => person, :created_at => Time.now, :verb => 'leave_scrap')
- ActionTracker::Record.create!(:target => c2, :user => person, :created_at => Time.now, :verb => 'leave_scrap')
+ create(ActionTracker::Record, :target => c1, :user => person, :created_at => Time.now, :verb => 'leave_scrap')
+ create(ActionTracker::Record, :target => c2, :user => person, :created_at => Time.now, :verb => 'leave_scrap')
+ create(ActionTracker::Record, :target => c2, :user => person, :created_at => Time.now, :verb => 'leave_scrap')
get :communities, :filter => 'more_active'
assert_equal [c2,c1,c3] , assigns(:searches)[:communities][:results]
end
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb
index 8fbf7bd..2f4c8e7 100644
--- a/test/functional/users_controller_test.rb
+++ b/test/functional/users_controller_test.rb
@@ -135,7 +135,7 @@ class UsersControllerTest < ActionController::TestCase
should 'be able to remove a person' do
person = fast_create(Person, :environment_id => environment.id)
- assert_difference Person, :count, -1 do
+ assert_difference 'Person.count', -1 do
post :destroy_user, :id => person.id
end
end
@@ -143,7 +143,7 @@ class UsersControllerTest < ActionController::TestCase
should 'not crash if user does not exist' do
person = fast_create(Person)
- assert_no_difference Person, :count do
+ assert_no_difference 'Person.count' do
post :destroy_user, :id => 99999
end
assert_redirected_to :action => 'index'
--
libgit2 0.21.2