Sha256: 6e2f0e82fc4cbb60bdeb5858ebb2e0bdb6dee79e85c68d2eacb0423f2ef44f6c

Contents?: true

Size: 743 Bytes

Versions: 9

Compression:

Stored size: 743 Bytes

Contents

require 'rails_helper'

module Logistics
  module Core
    RSpec.describe Operation, type: :model do
      it 'has a valid factory' do
        expect(create(:operation)).to be_valid
      end

      it 'is invalid with no operation number' do
        expect(build(:operation, :operation_number => nil)).not_to be_valid
      end

      it 'minimally serializes request_no and operation_number' do
        ofr = create(:offer_request)
        op = Operation.create(operation_number: FFaker::Name.name, offer_request: ofr)
        data = ActiveModelSerializers::SerializableResource.new(op).as_json
        expect(data[:offer_request_id]).to eq ofr.id
        expect(data[:operation_number]).to eq op.operation_number
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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