Sha256: 50b1aa21a9d99ac4170eb16214706599daeb0f1e642515614d16ba15880441f7

Contents?: true

Size: 1.28 KB

Versions: 11

Compression:

Stored size: 1.28 KB

Contents

require 'foreman_tasks_test_helper'

module ForemanRecurringLogic
  class Api::RecurringLogicControllerTest < ActionController::TestCase
    describe 'recurring logic api controller' do
      tests ForemanTasks::Api::RecurringLogicsController

      before do
        User.current = User.where(:login => 'apiadmin').first
        @request.env['HTTP_ACCEPT'] = 'application/json'
        @request.env['CONTENT_TYPE'] = 'application/json'
        @recurring_logic = FactoryBot.create(:recurring_logic)
      end

      describe 'GET /api/recurring_logics' do
        it 'gets index' do
          get :index
          assert_response :success
          assert_template 'api/recurring_logics/index'
        end
      end

      describe 'GET /api/recurring_logics/:id' do
        it 'searches for recurring logic' do
          get :show, params: { :id => @recurring_logic.id }
          assert_response :success
          assert_template 'api/recurring_logics/show'
        end
      end

      describe 'POST /api/recurring_logics/:id/cancel' do
        it 'cancels recurring logic' do
          post :cancel, params: { :id => @recurring_logic.id }
          assert_response :success
          @recurring_logic.reload
          assert @recurring_logic.state == 'cancelled'
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
foreman-tasks-0.11.3 test/controllers/api/recurring_logics_controller_test.rb
foreman-tasks-0.13.4 test/controllers/api/recurring_logics_controller_test.rb
foreman-tasks-0.13.3 test/controllers/api/recurring_logics_controller_test.rb
foreman-tasks-0.13.2 test/controllers/api/recurring_logics_controller_test.rb
foreman-tasks-0.13.1 test/controllers/api/recurring_logics_controller_test.rb
foreman-tasks-0.13.0 test/controllers/api/recurring_logics_controller_test.rb
foreman-tasks-0.12.2 test/controllers/api/recurring_logics_controller_test.rb
foreman-tasks-0.11.2 test/controllers/api/recurring_logics_controller_test.rb
foreman-tasks-0.12.1 test/controllers/api/recurring_logics_controller_test.rb
foreman-tasks-0.12.0 test/controllers/api/recurring_logics_controller_test.rb
foreman-tasks-0.11.1 test/controllers/api/recurring_logics_controller_test.rb