Sha256: f89e36666342c4f35483526a1a5cc4abbd6364849b2b68c5d13cadf97ae1ed12

Contents?: true

Size: 965 Bytes

Versions: 1

Compression:

Stored size: 965 Bytes

Contents

require 'spec_helper'
require 'pact_broker/api/decorators/pacticipant_collection_decorator'
require 'pact_broker/domain/pacticipant'

module PactBroker

  module Api

    module Decorators

      describe PacticipantCollectionRepresenter do

        subject { JSON.parse PacticipantCollectionRepresenter.new(pacticipants).to_json, symbolize_names: true }

        context "with no pacticipants" do
          let(:pacticipants) { [] }

          it "doesn't blow up" do
            subject
          end
        end

        context "with pacticipants" do
          let(:pacticipant) { PactBroker::Domain::Pacticipant.new(name: 'Name', created_at: DateTime.new, updated_at: DateTime.new)}
          let(:pacticipants) { [pacticipant] }

          it "displays a list of pacticipants" do
            expect(subject[:pacticipants]).to be_instance_of(Array)
            expect(subject[:pacticipants].size).to eq 1
          end
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pact_broker-1.4.0 spec/lib/pact_broker/api/decorators/pacticipant_collection_decorator_spec.rb