Sha256: bb74e17da48eedf40bd7eb8882318a5f8e60bcfa77317979007461af99b2dba6

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true
require "spec_helper"

module SocialNetworking
  module Serializers
    RSpec.describe NudgeSerializer do
      let(:initiator) { instance_double(Participant, is_admin: true) }
      let(:profile) { instance_double(Profile) }
      let(:nudge) do
        instance_double(
          Nudge,
          id: 1,
          initiator_id: 1,
          created_at: Time.zone.now,
          recipient_id: 1,
          comments: []
        )
      end
      let(:serialized_nudge) do
        NudgeSerializer
          .new(nudge)
          .to_serialized
      end

      describe ".to_serialized" do
        it "includes necessary properties" do
          allow(nudge).to receive(:initiator) { initiator }
          allow(Profile).to receive(:find_by_participant_id) { profile }
          allow(profile).to receive(:user_name)

          expect(serialized_nudge)
            .to include(
              :className,
              :id,
              :participantId,
              :isAdmin,
              :createdAt,
              :createdAtRaw,
              :initiatorId,
              :recipientId,
              :summary,
              :description,
              :comments
            )
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
social_networking-0.13.3 spec/models/social_networking/serializers/nudge_serializer_spec.rb
social_networking-0.13.2 spec/models/social_networking/serializers/nudge_serializer_spec.rb
social_networking-0.13.1 spec/models/social_networking/serializers/nudge_serializer_spec.rb
social_networking-0.13.0 spec/models/social_networking/serializers/nudge_serializer_spec.rb
social_networking-0.12.0 spec/models/social_networking/serializers/nudge_serializer_spec.rb