[Git][noosfero/noosfero][master] CommunityTrack: load the correct box in functional tests
Leandro Nunes
gitlab at gitlab.com
Tue Jul 21 09:02:44 BRT 2015
Leandro Nunes pushed to branch master at Noosfero / noosfero
Commits:
a49d8fe5 by Leandro Nunes dos Santos at 2015-07-21T09:02:14Z
CommunityTrack: load the correct box in functional tests
- - - - -
18 changed files:
- plugins/community_track/controllers/myprofile/community_track_plugin_myprofile_controller.rb
- plugins/community_track/controllers/public/community_track_plugin_public_controller.rb
- plugins/community_track/lib/community_track_plugin/track.rb
- plugins/community_track/test/functional/community_track_plugin_cms_controller_test.rb
- plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb
- plugins/community_track/test/functional/community_track_plugin_environment_design_controller_test.rb
- plugins/community_track/test/functional/community_track_plugin_myprofile_controller_test.rb
- plugins/community_track/test/functional/community_track_plugin_public_controller_test.rb
- plugins/community_track/test/test_helper.rb
- plugins/community_track/test/unit/article_test.rb
- plugins/community_track/test/unit/community_track_plugin/activation_job_test.rb
- plugins/community_track/test/unit/community_track_plugin/step_helper_test.rb
- plugins/community_track/test/unit/community_track_plugin/step_test.rb
- plugins/community_track/test/unit/community_track_plugin/track_card_list_block_test.rb
- plugins/community_track/test/unit/community_track_plugin/track_helper_test.rb
- plugins/community_track/test/unit/community_track_plugin/track_list_block_test.rb
- plugins/community_track/test/unit/community_track_plugin/track_test.rb
- plugins/community_track/test/unit/community_track_plugin_test.rb
Changes:
=====================================
plugins/community_track/controllers/myprofile/community_track_plugin_myprofile_controller.rb
=====================================
--- a/plugins/community_track/controllers/myprofile/community_track_plugin_myprofile_controller.rb
+++ b/plugins/community_track/controllers/myprofile/community_track_plugin_myprofile_controller.rb
@@ -1,5 +1,4 @@
class CommunityTrackPluginMyprofileController < MyProfileController
- append_view_path File.join(File.dirname(__FILE__) + '/../../views')
before_filter :allow_edit_track, :only => :save_order
=====================================
plugins/community_track/controllers/public/community_track_plugin_public_controller.rb
=====================================
--- a/plugins/community_track/controllers/public/community_track_plugin_public_controller.rb
+++ b/plugins/community_track/controllers/public/community_track_plugin_public_controller.rb
@@ -1,5 +1,4 @@
class CommunityTrackPluginPublicController < PublicController
- append_view_path File.join(File.dirname(__FILE__) + '/../../views')
no_design_blocks
=====================================
plugins/community_track/lib/community_track_plugin/track.rb
=====================================
--- a/plugins/community_track/lib/community_track_plugin/track.rb
+++ b/plugins/community_track/lib/community_track_plugin/track.rb
@@ -65,7 +65,8 @@ class CommunityTrackPlugin::Track < Folder
def category_name
category = categories.first
- category ? category.top_ancestor.name : ''
+ category = category.top_ancestor unless category.nil?
+ category.nil? ? '' : category.name
end
def to_html(options = {})
=====================================
plugins/community_track/test/functional/community_track_plugin_cms_controller_test.rb
=====================================
--- a/plugins/community_track/test/functional/community_track_plugin_cms_controller_test.rb
+++ b/plugins/community_track/test/functional/community_track_plugin_cms_controller_test.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../test_helper'
+require_relative '../test_helper'
# Re-raise errors caught by the controller.
class CmsController; def rescue_action(e) raise e end; end
=====================================
plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb
=====================================
--- a/plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb
+++ b/plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb
@@ -1,12 +1,6 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class ContentViewerController
- append_view_path File.join(File.dirname(__FILE__) + '/../../views')
- def rescue_action(e)
- raise e
- end
-end
+require_relative '../test_helper'
+class ContentViewerController; def rescue_action(e) raise e end; end
class ContentViewerControllerTest < ActionController::TestCase
def setup
@@ -87,32 +81,32 @@ class ContentViewerControllerTest < ActionController::TestCase
end
should 'render a div with block id for track list block' do
- @block = CommunityTrackPlugin::TrackListBlock.create!(:box => @profile.boxes.last)
+ @block = CommunityTrackPlugin::TrackListBlock.create!(:box => @profile.boxes.first)
get :view_page, @step.url
assert_tag :tag => 'div', :attributes => { :class => 'track_list', :id => "track_list_#{@block.id}" }
end
should 'render a div with block id for track card list block' do
- @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.last)
+ @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.first)
get :view_page, @step.url
assert_tag :tag => 'div', :attributes => { :class => 'track_list', :id => "track_list_#{@block.id}" }
end
should 'render tracks in track list block' do
- @block = CommunityTrackPlugin::TrackListBlock.create!(:box => @profile.boxes.last)
+ @block = CommunityTrackPlugin::TrackListBlock.create!(:box => @profile.boxes.first)
get :view_page, @step.url
assert_tag :tag => 'div', :attributes => { :class => "item category_#{@track.category_name}" }, :descendant => { :tag => 'div', :attributes => { :class => 'steps' }, :descendant => { :tag => 'span', :attributes => { :class => "step #{@block.status_class(@step)}" } } }
end
should 'render tracks in track card list block' do
- @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.last)
+ @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.first)
get :view_page, @step.url
assert_tag :tag => 'div', :attributes => { :class => "item_card category_#{@track.category_name}" }, :descendant => { :tag => 'div', :attributes => { :class => 'track_content' } }
assert_tag :tag => 'div', :attributes => { :class => "item_card category_#{@track.category_name}" }, :descendant => { :tag => 'div', :attributes => { :class => 'track_stats' } }
end
should 'render link to display more tracks in track list block' do
- @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.last)
+ @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.first)
(@block.limit+1).times { |i| create_track("track#{i}", @profile) }
get :view_page, @step.url
@@ -120,7 +114,7 @@ class ContentViewerControllerTest < ActionController::TestCase
end
should 'render link to show all tracks in track list block' do
- @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.last)
+ @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.first)
@block.more_another_page = true
@block.save!
=====================================
plugins/community_track/test/functional/community_track_plugin_environment_design_controller_test.rb
=====================================
--- a/plugins/community_track/test/functional/community_track_plugin_environment_design_controller_test.rb
+++ b/plugins/community_track/test/functional/community_track_plugin_environment_design_controller_test.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../test_helper'
+require_relative '../test_helper'
# Re-raise errors caught by the controller.
class EnvironmentDesignController; def rescue_action(e) raise e end; end
=====================================
plugins/community_track/test/functional/community_track_plugin_myprofile_controller_test.rb
=====================================
--- a/plugins/community_track/test/functional/community_track_plugin_myprofile_controller_test.rb
+++ b/plugins/community_track/test/functional/community_track_plugin_myprofile_controller_test.rb
@@ -1,5 +1,5 @@
-require File.dirname(__FILE__) + '/../test_helper'
-require File.dirname(__FILE__) + '/../../controllers/myprofile/community_track_plugin_myprofile_controller'
+require_relative '../test_helper'
+require_relative '../../controllers/myprofile/community_track_plugin_myprofile_controller'
# Re-raise errors caught by the controller.
class CommunityTrackPluginMyprofileController; def rescue_action(e) raise e end; end
@@ -7,10 +7,6 @@ class CommunityTrackPluginMyprofileController; def rescue_action(e) raise e end;
class CommunityTrackPluginMyprofileControllerTest < ActionController::TestCase
def setup
- @controller = CommunityTrackPluginMyprofileController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
-
@profile = fast_create(Community)
@track = create_track('track', @profile)
=====================================
plugins/community_track/test/functional/community_track_plugin_public_controller_test.rb
=====================================
--- a/plugins/community_track/test/functional/community_track_plugin_public_controller_test.rb
+++ b/plugins/community_track/test/functional/community_track_plugin_public_controller_test.rb
@@ -1,5 +1,5 @@
-require File.dirname(__FILE__) + '/../test_helper'
-require File.dirname(__FILE__) + '/../../controllers/public/community_track_plugin_public_controller'
+require_relative '../test_helper'
+require_relative '../../controllers/public/community_track_plugin_public_controller'
# Re-raise errors caught by the controller.
class CommunityTrackPluginPublicController; def rescue_action(e) raise e end; end
=====================================
plugins/community_track/test/test_helper.rb
=====================================
--- a/plugins/community_track/test/test_helper.rb
+++ b/plugins/community_track/test/test_helper.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../../../test/test_helper'
+require_relative '../../../test/test_helper'
def create_track(name, profile)
track = CommunityTrackPlugin::Track.new(:abstract => 'abstract', :body => 'body', :name => name, :profile => profile)
=====================================
plugins/community_track/test/unit/article_test.rb
=====================================
--- a/plugins/community_track/test/unit/article_test.rb
+++ b/plugins/community_track/test/unit/article_test.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../test_helper'
+require_relative '../test_helper'
class ArticleTest < ActiveSupport::TestCase
=====================================
plugins/community_track/test/unit/community_track_plugin/activation_job_test.rb
=====================================
--- a/plugins/community_track/test/unit/community_track_plugin/activation_job_test.rb
+++ b/plugins/community_track/test/unit/community_track_plugin/activation_job_test.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../../test_helper'
+require_relative '../../test_helper'
class ActivationJobTest < ActiveSupport::TestCase
=====================================
plugins/community_track/test/unit/community_track_plugin/step_helper_test.rb
=====================================
--- a/plugins/community_track/test/unit/community_track_plugin/step_helper_test.rb
+++ b/plugins/community_track/test/unit/community_track_plugin/step_helper_test.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../../test_helper'
+require_relative '../../test_helper'
class StepHelperTest < ActiveSupport::TestCase
=====================================
plugins/community_track/test/unit/community_track_plugin/step_test.rb
=====================================
--- a/plugins/community_track/test/unit/community_track_plugin/step_test.rb
+++ b/plugins/community_track/test/unit/community_track_plugin/step_test.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../../test_helper'
+require_relative '../../test_helper'
class StepTest < ActiveSupport::TestCase
=====================================
plugins/community_track/test/unit/community_track_plugin/track_card_list_block_test.rb
=====================================
--- a/plugins/community_track/test/unit/community_track_plugin/track_card_list_block_test.rb
+++ b/plugins/community_track/test/unit/community_track_plugin/track_card_list_block_test.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../../test_helper'
+require_relative '../../test_helper'
class TrackCardListBlockTest < ActiveSupport::TestCase
=====================================
plugins/community_track/test/unit/community_track_plugin/track_helper_test.rb
=====================================
--- a/plugins/community_track/test/unit/community_track_plugin/track_helper_test.rb
+++ b/plugins/community_track/test/unit/community_track_plugin/track_helper_test.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../../test_helper'
+require_relative '../../test_helper'
class TrackHelperTest < ActiveSupport::TestCase
=====================================
plugins/community_track/test/unit/community_track_plugin/track_list_block_test.rb
=====================================
--- a/plugins/community_track/test/unit/community_track_plugin/track_list_block_test.rb
+++ b/plugins/community_track/test/unit/community_track_plugin/track_list_block_test.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../../test_helper'
+require_relative '../../test_helper'
class TrackListBlockTest < ActiveSupport::TestCase
=====================================
plugins/community_track/test/unit/community_track_plugin/track_test.rb
=====================================
--- a/plugins/community_track/test/unit/community_track_plugin/track_test.rb
+++ b/plugins/community_track/test/unit/community_track_plugin/track_test.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../../test_helper'
+require_relative '../../test_helper'
class TrackTest < ActiveSupport::TestCase
=====================================
plugins/community_track/test/unit/community_track_plugin_test.rb
=====================================
--- a/plugins/community_track/test/unit/community_track_plugin_test.rb
+++ b/plugins/community_track/test/unit/community_track_plugin_test.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../test_helper'
+require_relative '../test_helper'
class CommunityTrackPluginTest < ActiveSupport::TestCase
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/a49d8fe5f9d802bb829e0e63fd8cf18aaeb61bc8
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150721/0e338450/attachment-0001.html>
More information about the Noosfero-dev
mailing list