Commit 6e1166023664cc8275c36d4ceb2733e64174f930
1 parent
904f1fb4
Exists in
master
and in
27 other branches
rails3: fix display_content plugin
Showing
2 changed files
with
12 additions
and
11 deletions
Show diff stats
plugins/display_content/lib/display_content_block.rb
| ... | ... | @@ -26,7 +26,7 @@ class DisplayContentBlock < Block |
| 26 | 26 | settings_items :display_folder_children, :type => :boolean, :default => true |
| 27 | 27 | settings_items :types, :type => Array, :default => ['TextileArticle', 'TinyMceArticle', 'RawHTMLArticle'] |
| 28 | 28 | |
| 29 | - attr_accessible :sections, :checked_nodes, :display_folder_children | |
| 29 | + attr_accessible :sections, :checked_nodes, :display_folder_children, :types | |
| 30 | 30 | |
| 31 | 31 | def self.description |
| 32 | 32 | _('Display your contents') | ... | ... |
plugins/display_content/test/unit/display_content_block_test.rb
| ... | ... | @@ -350,10 +350,11 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 350 | 350 | should 'list links for all articles title defined in nodes' do |
| 351 | 351 | profile = create_user('testuser').person |
| 352 | 352 | Article.delete_all |
| 353 | - a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) | |
| 354 | - a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | |
| 353 | + a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | |
| 354 | + a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | |
| 355 | 355 | |
| 356 | 356 | block = DisplayContentBlock.new |
| 357 | + block.sections = [{:value => 'title', :checked => true}] | |
| 357 | 358 | block.nodes = [a1.id, a2.id] |
| 358 | 359 | box = mock() |
| 359 | 360 | block.stubs(:box).returns(box) |
| ... | ... | @@ -366,8 +367,8 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 366 | 367 | should 'list content for all articles lead defined in nodes' do |
| 367 | 368 | profile = create_user('testuser').person |
| 368 | 369 | Article.delete_all |
| 369 | - a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'abstract article 1') | |
| 370 | - a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :abstract => 'abstract article 2') | |
| 370 | + a1 = fast_create(TinyMceArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'abstract article 1') | |
| 371 | + a2 = fast_create(TinyMceArticle, :name => 'test article 2', :profile_id => profile.id, :abstract => 'abstract article 2') | |
| 371 | 372 | |
| 372 | 373 | block = DisplayContentBlock.new |
| 373 | 374 | block.sections = [{:value => 'abstract', :checked => true}] |
| ... | ... | @@ -421,7 +422,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 421 | 422 | |
| 422 | 423 | should 'show title if defined by user' do |
| 423 | 424 | profile = create_user('testuser').person |
| 424 | - a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) | |
| 425 | + a = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | |
| 425 | 426 | |
| 426 | 427 | block = DisplayContentBlock.new |
| 427 | 428 | block.nodes = [a.id] |
| ... | ... | @@ -435,7 +436,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 435 | 436 | |
| 436 | 437 | should 'show abstract if defined by user' do |
| 437 | 438 | profile = create_user('testuser').person |
| 438 | - a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'some abstract') | |
| 439 | + a = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'some abstract') | |
| 439 | 440 | |
| 440 | 441 | block = DisplayContentBlock.new |
| 441 | 442 | block.nodes = [a.id] |
| ... | ... | @@ -449,7 +450,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 449 | 450 | |
| 450 | 451 | should 'show body if defined by user' do |
| 451 | 452 | profile = create_user('testuser').person |
| 452 | - a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :body => 'some body') | |
| 453 | + a = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :body => 'some body') | |
| 453 | 454 | |
| 454 | 455 | block = DisplayContentBlock.new |
| 455 | 456 | block.nodes = [a.id] |
| ... | ... | @@ -577,7 +578,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 577 | 578 | block.types = ['TinyMceArticle'] |
| 578 | 579 | |
| 579 | 580 | block.types = ['TinyMceArticle', 'Folder'] |
| 580 | - assert_equal [TinyMceArticle, Folder, UploadedFile, Event, TextileArticle, RawHTMLArticle, Blog, Forum, Gallery, RssFeed], block.available_content_types | |
| 581 | + assert_equivalent [TinyMceArticle, Folder, UploadedFile, Event, TextileArticle, RawHTMLArticle, Blog, Forum, Gallery, RssFeed], block.available_content_types | |
| 581 | 582 | end |
| 582 | 583 | |
| 583 | 584 | should 'return available content types' do |
| ... | ... | @@ -585,7 +586,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 585 | 586 | block = DisplayContentBlock.create! |
| 586 | 587 | block.types = ['TinyMceArticle'] |
| 587 | 588 | block.types = [] |
| 588 | - assert_equal [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed], block.available_content_types | |
| 589 | + assert_equivalent [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed], block.available_content_types | |
| 589 | 590 | end |
| 590 | 591 | |
| 591 | 592 | should 'return first 2 content types' do |
| ... | ... | @@ -629,7 +630,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 629 | 630 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([SomePlugin.new]) |
| 630 | 631 | |
| 631 | 632 | block.types = [] |
| 632 | - assert_equal [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed, SomePluginContent], block.available_content_types | |
| 633 | + assert_equivalent [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed, SomePluginContent], block.available_content_types | |
| 633 | 634 | end |
| 634 | 635 | |
| 635 | 636 | should 'do not fail if a selected article was removed' do | ... | ... |