cirandas.net

ref: master

test/unit/profile_search_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
require_relative "../test_helper"

class ProfileSearchBlockTest < ActiveSupport::TestCase

  should 'describe itself' do
    assert_not_equal Block.description, ProfileSearchBlock.description
  end

  should 'not provide a default title' do
    assert_equal Block.new.default_title, ProfileSearchBlock.new.default_title
  end

  include BoxesHelper

  should 'render profile search' do
    person = fast_create(Person)

    block = ProfileSearchBlock.new
    block.stubs(:owner).returns(person)

    self.expects(:render).with(template: 'blocks/profile_search', locals: { block: block })
    render_block_content(block)
  end

  should 'provide view_title' do
    person = fast_create(Person)
    person.boxes << Box.new
    block = ProfileSearchBlock.new(title: 'Title from block')
    person.boxes.first.blocks << block
    block.save!
    assert_equal 'Title from block', block.view_title
  end

end