cirandas.net

ref: master

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

class TaskHelperTest < ActionView::TestCase

  include ApplicationHelper

  def setup
    @profile = fast_create(Profile)
    @task = fast_create(Task, :target_id => @profile.id)
  end

  attr_accessor :task, :profile

  should 'return select field for template selection when there is templates to choose' do
    email_templates = 3.times.map { EmailTemplate.new }
    assert_tag_in_string task_email_template('Description', email_templates, task), :tag => 'div', :attributes => {:class => 'template-selection'}
  end

  should 'not return select field for template selection when there is no templates to choose' do
    assert task_email_template('Description', [], task).blank?
  end

end