Sha256: 7f00473d7db121769c6c64a5b312d0f99b708d0888dfb6a2b10366ff2522fd47

Contents?: true

Size: 1.3 KB

Versions: 52

Compression:

Stored size: 1.3 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

52 entries across 52 versions & 1 rubygems

Version Path
foreman-tasks-9.0.4 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-9.1.0 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-9.0.2 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-9.0.1 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-8.3.3 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-9.0.0 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-8.2.1 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-8.1.4 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-8.3.2 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-8.3.1 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-8.1.3 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-8.3.0 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-8.2.0 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-8.1.2 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-8.1.1 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-8.1.0 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-8.0.2 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-8.0.1 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-8.0.0 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb
foreman-tasks-7.2.1 test/helpers/foreman_tasks/foreman_tasks_helper_test.rb