Sha256: 2b3b57ce0fc919c04e4635860fee7076f788ba398d41963ad015c8664a1e1ead

Contents?: true

Size: 1.12 KB

Versions: 11

Compression:

Stored size: 1.12 KB

Contents

require "spec_helper"

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

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

      describe ".all" do
        context "when no likes performed" do
          it "returns an empty array" do
            SocialNetworking::Like.destroy_all

            expect(data).to be_empty
          end
        end

        context "when likes performed" do
          it "returns accurate summaries" do
            participant = participants(:participant1)
            like = SocialNetworking::Like
                   .find_by_participant_id(participant.id)
            item = (like.item.try(:item) || like.item)

            expect(data.count).to eq SocialNetworking::Like.count
            expect(data).to include(
              participant_id: participant.study_id,
              occurred_at: like.created_at.iso8601,
              item_type: item.class.to_s,
              item_participant_id: item.participant.study_id,
              item_content: like.item_description
            )
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
social_networking-0.11.8 spec/models/social_networking/reports/like_report_spec.rb
social_networking-0.11.7 spec/models/social_networking/reports/like_report_spec.rb
social_networking-0.11.6 spec/models/social_networking/reports/like_report_spec.rb
social_networking-0.11.5 spec/models/social_networking/reports/like_report_spec.rb
social_networking-0.11.4 spec/models/social_networking/reports/like_report_spec.rb
social_networking-0.11.3 spec/models/social_networking/reports/like_report_spec.rb
social_networking-0.11.2 spec/models/social_networking/reports/like_report_spec.rb
social_networking-0.11.1 spec/models/social_networking/reports/like_report_spec.rb
social_networking-0.11.0 spec/models/social_networking/reports/like_report_spec.rb
social_networking-0.10.0 spec/models/social_networking/reports/like_report_spec.rb
social_networking-0.9.3 spec/models/social_networking/reports/like_report_spec.rb