Commit 1fb173b3a28368e7b7f6b36945bc7d5895b7bb60
1 parent
03dce3f0
Exists in
master
and in
23 other branches
updating display content plugin unit tests
Showing
1 changed file
with
11 additions
and
9 deletions
Show diff stats
plugins/display_content/test/unit/display_content_block_test.rb
| @@ -566,7 +566,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -566,7 +566,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
| 566 | a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :abstract => 'abstract article 2') | 566 | a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :abstract => 'abstract article 2') |
| 567 | 567 | ||
| 568 | block = DisplayContentBlock.new | 568 | block = DisplayContentBlock.new |
| 569 | - block.chosen_attributes = ['abstract'] | 569 | + block.sections = [{:name => 'Abstract', :checked => true}] |
| 570 | block.nodes = [a1.id, a2.id] | 570 | block.nodes = [a1.id, a2.id] |
| 571 | box = mock() | 571 | box = mock() |
| 572 | block.stubs(:box).returns(box) | 572 | block.stubs(:box).returns(box) |
| @@ -619,7 +619,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -619,7 +619,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
| 619 | 619 | ||
| 620 | block = DisplayContentBlock.new | 620 | block = DisplayContentBlock.new |
| 621 | block.nodes = [a.id] | 621 | block.nodes = [a.id] |
| 622 | - block.chosen_attributes = ['title'] | 622 | + block.sections = [{:name => 'Title', :checked => true}] |
| 623 | box = mock() | 623 | box = mock() |
| 624 | block.stubs(:box).returns(box) | 624 | block.stubs(:box).returns(box) |
| 625 | box.stubs(:owner).returns(profile) | 625 | box.stubs(:owner).returns(profile) |
| @@ -633,7 +633,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -633,7 +633,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
| 633 | 633 | ||
| 634 | block = DisplayContentBlock.new | 634 | block = DisplayContentBlock.new |
| 635 | block.nodes = [a.id] | 635 | block.nodes = [a.id] |
| 636 | - block.chosen_attributes = ['abstract'] | 636 | + block.sections = [{:name => 'Abstract', :checked => true}] |
| 637 | box = mock() | 637 | box = mock() |
| 638 | block.stubs(:box).returns(box) | 638 | block.stubs(:box).returns(box) |
| 639 | box.stubs(:owner).returns(profile) | 639 | box.stubs(:owner).returns(profile) |
| @@ -647,7 +647,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -647,7 +647,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
| 647 | 647 | ||
| 648 | block = DisplayContentBlock.new | 648 | block = DisplayContentBlock.new |
| 649 | block.nodes = [a.id] | 649 | block.nodes = [a.id] |
| 650 | - block.chosen_attributes = ['body'] | 650 | + block.sections = [{:name => 'Body', :checked => true}] |
| 651 | box = mock() | 651 | box = mock() |
| 652 | block.stubs(:box).returns(box) | 652 | block.stubs(:box).returns(box) |
| 653 | box.stubs(:owner).returns(profile) | 653 | box.stubs(:owner).returns(profile) |
| @@ -660,16 +660,18 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -660,16 +660,18 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
| 660 | 660 | ||
| 661 | block = DisplayContentBlock.new | 661 | block = DisplayContentBlock.new |
| 662 | 662 | ||
| 663 | - assert block.display_attribute?('title') | 663 | + assert block.display_section?({:name => 'Title', :checked => true}) |
| 664 | end | 664 | end |
| 665 | 665 | ||
| 666 | should 'display_attribute be true if the attribute was chosen' do | 666 | should 'display_attribute be true if the attribute was chosen' do |
| 667 | profile = create_user('testuser').person | 667 | profile = create_user('testuser').person |
| 668 | - | 668 | + |
| 669 | block = DisplayContentBlock.new | 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 | end | 675 | end |
| 674 | 676 | ||
| 675 | end | 677 | end |