Sha256: 5d73794aec252a5e26129de79642bd7ccb0cc63ace5cdcb40114f135f484aef1

Contents?: true

Size: 942 Bytes

Versions: 5

Compression:

Stored size: 942 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

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

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

      describe ".all" do
        context "when no nudges performed" do
          it "returns an empty array" do
            SocialNetworking::Nudge.destroy_all
            expect(data).to be_empty
          end
        end

        context "when nudges performed" do
          it "returns accurate summaries" do
            participant = participants(:participant1)
            nudge = SocialNetworking::Nudge.first
            expect(data.count).to eq 4
            expect(data).to include(
              participant_id: participant.study_id,
              occurred_at: nudge.created_at.iso8601,
              recipient_id: nudge.recipient.study_id
            )
          end
        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/reports/nudge_report_spec.rb
social_networking-0.13.2 spec/models/social_networking/reports/nudge_report_spec.rb
social_networking-0.13.1 spec/models/social_networking/reports/nudge_report_spec.rb
social_networking-0.13.0 spec/models/social_networking/reports/nudge_report_spec.rb
social_networking-0.12.0 spec/models/social_networking/reports/nudge_report_spec.rb