Sha256: 63231dcf2614a0727e02a8658e27935279fe11f59ff6e28857a0c89748d257a2

Contents?: true

Size: 1.28 KB

Versions: 25

Compression:

Stored size: 1.28 KB

Contents

require 'foreman_tasks_test_helper'

module ForemanTasks
  class ForemanTasksHelperTest < ActionView::TestCase
    describe 'breadcrumb items' do
      before do
        self.class.send(:include, ForemanTasks::TasksHelper)
      end

      it 'prepares items for index correctly' do
        stubs(:action_name).returns('index')
        items = breadcrumb_items
        items.count.must_equal 1
        items.first[:caption].must_equal 'Tasks'
        items.first[:url].must_be_nil
      end

      it 'prepares items for show correctly' do
        @task = FactoryBot.build(:dynflow_task, :user_create_task)
        @task.action = 'A task'
        stubs(:action_name).returns('show')
        items = breadcrumb_items
        items.map { |i| i[:caption] }.must_equal ['Tasks', 'A task']
        items.last[:url].must_be_nil
      end

      it 'prepares items for sub tasks correctly' do
        @task = FactoryBot.build(:dynflow_task, :user_create_task)
        child = FactoryBot.build(:dynflow_task, :user_create_task)
        @task.sub_tasks = [child]
        @task.action = 'A task'
        stubs(:action_name).returns('sub_tasks')
        items = breadcrumb_items
        items.map { |i| i[:caption] }.must_equal ['Tasks', 'A task', 'Sub tasks']
        items.last[:url].must_be_nil
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
foreman-tasks-2.0.3 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-2.0.2 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-1.1.3 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-1.1.2 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-2.0.1 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-2.0.0 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-1.2.0 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-1.1.1 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-1.1.0 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-0.17.6 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-1.0.1 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-1.0.0 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-0.17.5 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-0.17.4 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-0.17.3 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-0.17.2 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-0.16.3 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-0.17.1 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-0.15.11 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-0.16.2 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb