Sha256: 4cf5b5d5842849681093ac0740e68ecda463379511c940dbf0f4eccb35a4b071

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

require 'rails_helper'

module RailsWorkflow
  RSpec.describe ProcessTemplateSerializer, type: :serializer do
    context 'Default Builder' do
      it 'should serialize child process' do
        process_template = create :process_template

        parent_operation_template = create :parent_operation_template
        process_template.operations << parent_operation_template
        process_template.save

        check = ProcessTemplateSerializer.new(process_template).as_json['process_template']
        child_process_uuid = check[:operations].first[:child_process]
        expect(check[:child_processes].map { |pt| pt[:uuid] }).to include(child_process_uuid)
      end

      it 'should not fail if no child processes' do
        process_template = create :process_template
        operation_template = create :operation_template

        process_template.operations << operation_template
        process_template.save

        check = ProcessTemplateSerializer.new(process_template).as_json['process_template']
        expect(check[:child_processes]).to be_blank
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails_workflow-0.7.1 spec/serializers/process_template_serializer_spec.rb
rails_workflow-0.7.0 spec/serializers/process_template_serializer_spec.rb
rails_workflow-0.4.4 spec/serializers/process_template_serializer_spec.rb
rails_workflow-0.4.3 spec/serializers/process_template_serializer_spec.rb
rails_workflow-0.4.2 spec/serializers/process_template_serializer_spec.rb
rails_workflow-0.4.1 spec/serializers/process_template_serializer_spec.rb
rails_workflow-0.4.0 spec/serializers/process_template_serializer_spec.rb