Sha256: 4b3c2d4a1fbedda6dc53e78a2dac340bce79c1a43255025e16db44235eab5646

Contents?: true

Size: 1.51 KB

Versions: 9

Compression:

Stored size: 1.51 KB

Contents

require 'rails_helper'

module Logistics
  module Core
    RSpec.describe OperationTypesController, type: :controller do
      include LookupSpec

      def get_namespace
        'Logistics::Core'
      end

      routes { Logistics::Core::Engine.routes }
      let(:valid_attributes) {
        {
          code: FFaker::Name.name,
          name: FFaker::Name.name
        }
      }

      let(:invalid_attributes) {
        {
          code: '',
          name: FFaker::Name.name
        }
      }

      describe 'GET #index' do
        it 'gets all lookup' do
          get_index
        end
      end

      describe 'POST #create' do
        context 'with valid params' do
          it 'creates a new lookup' do
            post_valid
          end

          it 'should return a success message' do
            post_message
          end
        end

        context 'with invalid params' do
          it 'should return an error message' do
            post_invalid
          end
        end
      end

      describe 'PUT #update' do
        context 'with valid params' do
          let(:new_attributes) {
            {
              name: FFaker::Name.name
            }
          }

          it 'updates the requested lookup' do
            put_valid
          end

          it 'should return a success message' do
            put_message
          end
        end

        context 'with invalid params' do
          it 'should return an error message' do
            put_invalid
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
logistics_core-21.11.2 spec/controllers/logistics/core/operation_types_controller_spec.rb
logistics_core-21.11.1 spec/controllers/logistics/core/operation_types_controller_spec.rb
logistics_core-21.08.1 spec/controllers/logistics/core/operation_types_controller_spec.rb
logistics_core-21.03.1 spec/controllers/logistics/core/operation_types_controller_spec.rb
logistics_core-20.10.3 spec/controllers/logistics/core/operation_types_controller_spec.rb
logistics_core-20.10.2 spec/controllers/logistics/core/operation_types_controller_spec.rb
logistics_core-20.10.1 spec/controllers/logistics/core/operation_types_controller_spec.rb
logistics_core-20.9.1 spec/controllers/logistics/core/operation_types_controller_spec.rb
logistics_core-20.8.1 spec/controllers/logistics/core/operation_types_controller_spec.rb