Commit a49d8fe5f9d802bb829e0e63fd8cf18aaeb61bc8
1 parent
e833fc77
Exists in
master
and in
29 other branches
CommunityTrack: load the correct box in functional tests
Showing
18 changed files
with
26 additions
and
37 deletions
Show diff stats
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
... | ... | @@ -65,7 +65,8 @@ class CommunityTrackPlugin::Track < Folder |
65 | 65 | |
66 | 66 | def category_name |
67 | 67 | category = categories.first |
68 | - category ? category.top_ancestor.name : '' | |
68 | + category = category.top_ancestor unless category.nil? | |
69 | + category.nil? ? '' : category.name | |
69 | 70 | end |
70 | 71 | |
71 | 72 | def to_html(options = {}) | ... | ... |
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
1 | -require File.dirname(__FILE__) + '/../test_helper' | |
2 | - | |
3 | -class ContentViewerController | |
4 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
5 | - def rescue_action(e) | |
6 | - raise e | |
7 | - end | |
8 | -end | |
1 | +require_relative '../test_helper' | |
9 | 2 | |
3 | +class ContentViewerController; def rescue_action(e) raise e end; end | |
10 | 4 | class ContentViewerControllerTest < ActionController::TestCase |
11 | 5 | |
12 | 6 | def setup |
... | ... | @@ -87,32 +81,32 @@ class ContentViewerControllerTest < ActionController::TestCase |
87 | 81 | end |
88 | 82 | |
89 | 83 | should 'render a div with block id for track list block' do |
90 | - @block = CommunityTrackPlugin::TrackListBlock.create!(:box => @profile.boxes.last) | |
84 | + @block = CommunityTrackPlugin::TrackListBlock.create!(:box => @profile.boxes.first) | |
91 | 85 | get :view_page, @step.url |
92 | 86 | assert_tag :tag => 'div', :attributes => { :class => 'track_list', :id => "track_list_#{@block.id}" } |
93 | 87 | end |
94 | 88 | |
95 | 89 | should 'render a div with block id for track card list block' do |
96 | - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.last) | |
90 | + @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.first) | |
97 | 91 | get :view_page, @step.url |
98 | 92 | assert_tag :tag => 'div', :attributes => { :class => 'track_list', :id => "track_list_#{@block.id}" } |
99 | 93 | end |
100 | 94 | |
101 | 95 | should 'render tracks in track list block' do |
102 | - @block = CommunityTrackPlugin::TrackListBlock.create!(:box => @profile.boxes.last) | |
96 | + @block = CommunityTrackPlugin::TrackListBlock.create!(:box => @profile.boxes.first) | |
103 | 97 | get :view_page, @step.url |
104 | 98 | 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)}" } } } |
105 | 99 | end |
106 | 100 | |
107 | 101 | should 'render tracks in track card list block' do |
108 | - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.last) | |
102 | + @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.first) | |
109 | 103 | get :view_page, @step.url |
110 | 104 | assert_tag :tag => 'div', :attributes => { :class => "item_card category_#{@track.category_name}" }, :descendant => { :tag => 'div', :attributes => { :class => 'track_content' } } |
111 | 105 | assert_tag :tag => 'div', :attributes => { :class => "item_card category_#{@track.category_name}" }, :descendant => { :tag => 'div', :attributes => { :class => 'track_stats' } } |
112 | 106 | end |
113 | 107 | |
114 | 108 | should 'render link to display more tracks in track list block' do |
115 | - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.last) | |
109 | + @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.first) | |
116 | 110 | (@block.limit+1).times { |i| create_track("track#{i}", @profile) } |
117 | 111 | |
118 | 112 | get :view_page, @step.url |
... | ... | @@ -120,7 +114,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
120 | 114 | end |
121 | 115 | |
122 | 116 | should 'render link to show all tracks in track list block' do |
123 | - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.last) | |
117 | + @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.first) | |
124 | 118 | @block.more_another_page = true |
125 | 119 | @block.save! |
126 | 120 | ... | ... |
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
1 | -require File.dirname(__FILE__) + '/../test_helper' | |
2 | -require File.dirname(__FILE__) + '/../../controllers/myprofile/community_track_plugin_myprofile_controller' | |
1 | +require_relative '../test_helper' | |
2 | +require_relative '../../controllers/myprofile/community_track_plugin_myprofile_controller' | |
3 | 3 | |
4 | 4 | # Re-raise errors caught by the controller. |
5 | 5 | class CommunityTrackPluginMyprofileController; def rescue_action(e) raise e end; end |
... | ... | @@ -7,10 +7,6 @@ class CommunityTrackPluginMyprofileController; def rescue_action(e) raise e end; |
7 | 7 | class CommunityTrackPluginMyprofileControllerTest < ActionController::TestCase |
8 | 8 | |
9 | 9 | def setup |
10 | - @controller = CommunityTrackPluginMyprofileController.new | |
11 | - @request = ActionController::TestRequest.new | |
12 | - @response = ActionController::TestResponse.new | |
13 | - | |
14 | 10 | @profile = fast_create(Community) |
15 | 11 | @track = create_track('track', @profile) |
16 | 12 | ... | ... |
plugins/community_track/test/functional/community_track_plugin_public_controller_test.rb
1 | -require File.dirname(__FILE__) + '/../test_helper' | |
2 | -require File.dirname(__FILE__) + '/../../controllers/public/community_track_plugin_public_controller' | |
1 | +require_relative '../test_helper' | |
2 | +require_relative '../../controllers/public/community_track_plugin_public_controller' | |
3 | 3 | |
4 | 4 | # Re-raise errors caught by the controller. |
5 | 5 | class CommunityTrackPluginPublicController; def rescue_action(e) raise e end; end | ... | ... |
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