cirandas.net

ref: master

test/unit/main_block_test.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require_relative "../test_helper"

class MainBlockTest < ActiveSupport::TestCase

  should 'describe itself' do
    assert_kind_of String, MainBlock.description
    assert_not_equal Block.description, MainBlock.description
  end

  should 'have no content' do
    ok("MainBlock must not have a content") { MainBlock.new.content.blank? }
  end

  should 'be editable' do
    assert MainBlock.new.editable?
  end

  should 'be visible on environment' do
    env = Environment.new
    block = MainBlock.new
    block.stubs(:owner).returns(env)
    assert block.visible?
  end

  should 'not be visible on environment' do
    env = Environment.new
    block = MainBlock.new(:display => 'never')
    block.stubs(:owner).returns(env)
    refute block.visible?
  end

  should 'guarantee main block is always visible to everybody' do
    assert_equal MainBlock.new.display_user_options, {"all"=>_('All users')}
  end

end