Sha256: 776f11c4609fc81caac15eae638dea33cbceadc633e25bf2c56d44da8d6736ea

Contents?: true

Size: 1.06 KB

Versions: 11

Compression:

Stored size: 1.06 KB

Contents

require "spec_helper"

module SocialNetworking
  describe Comment, type: :model do
    fixtures(:participants, :"social_networking/goals")
    let(:participant1) { participants(:participant1) }
    let(:goal) { social_networking_goals(:participant2_goal_alpha) }

    it "should return the number of comments made today" do
      expect do
        Comment.create(
          participant_id: participant1.id,
          item: goal,
          text: "love this test",
          created_at: Date.today
        )
      end.to change { Comment.for_today.count }.by(1)
    end

    it "should return the number of comments made in the past seven days" do
      expect do
        Comment.create(
          participant_id: participant1.id,
          item: goal,
          text: "love this test",
          created_at: Date.today - 1.days
        )

        Comment.create(
          participant_id: participant1.id,
          item: goal,
          text: "love this test",
          created_at: Date.today - 8.days
        )
      end.to change { Comment.for_week.count }.by(1)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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