Sha256: 5040fd72903116e394b1c63ee538d97d9e244bbe5de003a464df2ac6a55746f7

Contents?: true

Size: 1.43 KB

Versions: 5

Compression:

Stored size: 1.43 KB

Contents

# frozen_string_literal: true
require "spec_helper"

module SocialNetworking
  RSpec.describe "social_networking/coach/patient_dashboards"\
                 "/tables/_initiator_nudges.html.erb",
                 type: :view do
    context "with two nudges" do
      let(:participant1) { instance_double(Participant, study_id: "foo") }
      let(:participant2) { instance_double(Participant, study_id: "bar") }
      let(:received) do
        instance_double(
          Nudge,
          created_at: Time.zone.now,
          initiator: participant2,
          recipient: participant1
        )
      end
      let(:sent) do
        instance_double(
          Nudge,
          created_at: Time.zone.now + 1.hour,
          initiator: participant1,
          recipient: participant2
        )
      end

      describe "Sent Nudges" do
        before do
          render partial: "social_networking/coach/patient_dashboards"\
                 "/tables/nudges/initiator_nudges.html.erb",
                 locals: { nudges: [sent] }
        end

        it "displays table heading" do
          expect(rendered).to have_text "Nudges Initiated"
        end

        it "displays each sent nudge's formated created_at time" do
          expect(rendered).to have_text sent.created_at.to_s(:standard)
        end

        it "displays sent nudges recipient's study id" do
          expect(rendered).to match participant2.study_id
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
social_networking-0.13.3 spec/views/social_networking/coach/patient_dashboards/tables/nudges/_initiator_nudges.html.erb_spec.rb
social_networking-0.13.2 spec/views/social_networking/coach/patient_dashboards/tables/nudges/_initiator_nudges.html.erb_spec.rb
social_networking-0.13.1 spec/views/social_networking/coach/patient_dashboards/tables/nudges/_initiator_nudges.html.erb_spec.rb
social_networking-0.13.0 spec/views/social_networking/coach/patient_dashboards/tables/nudges/_initiator_nudges.html.erb_spec.rb
social_networking-0.12.0 spec/views/social_networking/coach/patient_dashboards/tables/nudges/_initiator_nudges.html.erb_spec.rb