Sha256: 7420fb8c64d4f19f0348cde42be807239f4eea29f5d523e8544ca2ce7f988fb6

Contents?: true

Size: 1.37 KB

Versions: 11

Compression:

Stored size: 1.37 KB

Contents

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.now,
          initiator: participant2,
          recipient: participant1)
      end
      let(:sent) do
        instance_double(
          Nudge,
          created_at: Time.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

11 entries across 11 versions & 1 rubygems

Version Path
social_networking-0.11.8 spec/views/social_networking/coach/patient_dashboards/tables/nudges/_initiator_nudges.html.erb_spec.rb
social_networking-0.11.7 spec/views/social_networking/coach/patient_dashboards/tables/nudges/_initiator_nudges.html.erb_spec.rb
social_networking-0.11.6 spec/views/social_networking/coach/patient_dashboards/tables/nudges/_initiator_nudges.html.erb_spec.rb
social_networking-0.11.5 spec/views/social_networking/coach/patient_dashboards/tables/nudges/_initiator_nudges.html.erb_spec.rb
social_networking-0.11.4 spec/views/social_networking/coach/patient_dashboards/tables/nudges/_initiator_nudges.html.erb_spec.rb
social_networking-0.11.3 spec/views/social_networking/coach/patient_dashboards/tables/nudges/_initiator_nudges.html.erb_spec.rb
social_networking-0.11.2 spec/views/social_networking/coach/patient_dashboards/tables/nudges/_initiator_nudges.html.erb_spec.rb
social_networking-0.11.1 spec/views/social_networking/coach/patient_dashboards/tables/nudges/_initiator_nudges.html.erb_spec.rb
social_networking-0.11.0 spec/views/social_networking/coach/patient_dashboards/tables/nudges/_initiator_nudges.html.erb_spec.rb
social_networking-0.10.0 spec/views/social_networking/coach/patient_dashboards/tables/nudges/_initiator_nudges.html.erb_spec.rb
social_networking-0.9.3 spec/views/social_networking/coach/patient_dashboards/tables/nudges/_initiator_nudges.html.erb_spec.rb