Commit 73a5446e4b7bd9de266618cf8e4515fe62168e81
1 parent
270edd9e
Exists in
master
and in
28 other branches
Display top ancestor category at track card title
Showing
2 changed files
with
7 additions
and
5 deletions
Show diff stats
plugins/community_track/lib/community_track_plugin/track.rb
plugins/community_track/test/unit/community_track_plugin/track_test.rb
... | ... | @@ -39,10 +39,12 @@ class TrackTest < ActiveSupport::TestCase |
39 | 39 | assert_equal [@step], @track.steps_unsorted |
40 | 40 | end |
41 | 41 | |
42 | - should 'return category name' do | |
43 | - category = fast_create(Category, :name => 'category') | |
44 | - @track.add_category(category, true) | |
45 | - assert_equal 'category', @track.category_name | |
42 | + should 'return name of the top category' do | |
43 | + top = fast_create(Category, :name => 'top category') | |
44 | + category1 = fast_create(Category, :name => 'category1', :parent_id => top.id ) | |
45 | + category2 = fast_create(Category, :name => 'category2', :parent_id => category1.id ) | |
46 | + @track.add_category(category2, true) | |
47 | + assert_equal 'top category', @track.category_name | |
46 | 48 | end |
47 | 49 | |
48 | 50 | should 'return empty for category name if it has no category' do | ... | ... |