Commit 1fb173b3a28368e7b7f6b36945bc7d5895b7bb60

Authored by Francisco Marcelo A. Lima Júnior
1 parent 03dce3f0

updating display content plugin unit tests

plugins/display_content/test/unit/display_content_block_test.rb
... ... @@ -566,7 +566,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase
566 566 a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :abstract => 'abstract article 2')
567 567  
568 568 block = DisplayContentBlock.new
569   - block.chosen_attributes = ['abstract']
  569 + block.sections = [{:name => 'Abstract', :checked => true}]
570 570 block.nodes = [a1.id, a2.id]
571 571 box = mock()
572 572 block.stubs(:box).returns(box)
... ... @@ -619,7 +619,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase
619 619  
620 620 block = DisplayContentBlock.new
621 621 block.nodes = [a.id]
622   - block.chosen_attributes = ['title']
  622 + block.sections = [{:name => 'Title', :checked => true}]
623 623 box = mock()
624 624 block.stubs(:box).returns(box)
625 625 box.stubs(:owner).returns(profile)
... ... @@ -633,7 +633,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase
633 633  
634 634 block = DisplayContentBlock.new
635 635 block.nodes = [a.id]
636   - block.chosen_attributes = ['abstract']
  636 + block.sections = [{:name => 'Abstract', :checked => true}]
637 637 box = mock()
638 638 block.stubs(:box).returns(box)
639 639 box.stubs(:owner).returns(profile)
... ... @@ -647,7 +647,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase
647 647  
648 648 block = DisplayContentBlock.new
649 649 block.nodes = [a.id]
650   - block.chosen_attributes = ['body']
  650 + block.sections = [{:name => 'Body', :checked => true}]
651 651 box = mock()
652 652 block.stubs(:box).returns(box)
653 653 box.stubs(:owner).returns(profile)
... ... @@ -660,16 +660,18 @@ class DisplayContentBlockTest < ActiveSupport::TestCase
660 660  
661 661 block = DisplayContentBlock.new
662 662  
663   - assert block.display_attribute?('title')
  663 + assert block.display_section?({:name => 'Title', :checked => true})
664 664 end
665 665  
666 666 should 'display_attribute be true if the attribute was chosen' do
667 667 profile = create_user('testuser').person
668   -
  668 +
669 669 block = DisplayContentBlock.new
670   - block.chosen_attributes = ['body']
671   -
672   - assert block.display_attribute?('body')
  670 +
  671 + block.sections = [{:name => 'Body', :checked => true}]
  672 + section = block.sections.first
  673 +
  674 + assert block.display_section?(section)
673 675 end
674 676  
675 677 end
... ...