Sha256: d13dfe91c679646fda5088ed64611fb7c3bead9d3e7253a3ac24e62db92c6353

Contents?: true

Size: 1.54 KB

Versions: 9

Compression:

Stored size: 1.54 KB

Contents

require 'rails_helper'
require 'mks/common/methodresponse'

module Logistics
  module Core
    RSpec.describe CurrenciesController, 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/currencies_controller_spec.rb
logistics_core-21.11.1 spec/controllers/logistics/core/currencies_controller_spec.rb
logistics_core-21.08.1 spec/controllers/logistics/core/currencies_controller_spec.rb
logistics_core-21.03.1 spec/controllers/logistics/core/currencies_controller_spec.rb
logistics_core-20.10.3 spec/controllers/logistics/core/currencies_controller_spec.rb
logistics_core-20.10.2 spec/controllers/logistics/core/currencies_controller_spec.rb
logistics_core-20.10.1 spec/controllers/logistics/core/currencies_controller_spec.rb
logistics_core-20.9.1 spec/controllers/logistics/core/currencies_controller_spec.rb
logistics_core-20.8.1 spec/controllers/logistics/core/currencies_controller_spec.rb