Sha256: 1f673cdef1596e20edce9854aa8a085352b66814376aadbd7b98136399a61319

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true
require "spec_helper"

module SocialNetworking
  module Reports
    RSpec.describe Comment do
      fixtures :all

      def data
        @data ||= SocialNetworking::Reports::Comment.all
      end

      describe ".all" do
        context "when no comments made" do
          it "returns an empty array" do
            SocialNetworking::Comment.destroy_all
            expect(data).to be_empty
          end
        end

        context "when comments made" do
          it "returns accurate summaries" do
            expect(data.count).to eq 1
            participant = participants(:participant1)
            comment = SocialNetworking::Comment.first
            item = (comment.item.try(:item) || comment.item)
            expect(data).to include(
              participant_id: participant.study_id,
              occurred_at: comment.created_at.iso8601,
              item_type: item.class.to_s,
              text: comment.text
            )
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
social_networking-0.13.2 spec/models/social_networking/reports/comment_report_spec.rb
social_networking-0.13.1 spec/models/social_networking/reports/comment_report_spec.rb
social_networking-0.13.0 spec/models/social_networking/reports/comment_report_spec.rb
social_networking-0.12.0 spec/models/social_networking/reports/comment_report_spec.rb