Sha256: 93c6633c347cf1df1d681d947b8443b4230858aaec1f280375e2ed28332741c7

Contents?: true

Size: 1.5 KB

Versions: 66

Compression:

Stored size: 1.5 KB

Contents

require 'spec_helper'

describe ActivityAction do
  context "a following contact" do
    before do
      @tie = Factory(:friend)
    end

    it "should create follow action" do
      action = @tie.sender.action_to(@tie.receiver)

      action.should be_present
      action.should be_follow
    end

    it "should remove follow action" do
      action = @tie.sender.action_to(@tie.receiver)

      action.should be_present

      @tie.destroy

      action.reload.should_not be_follow
    end

    describe "where posting to other owner" do
      before do
        @post = Factory(:post)
      end

      it "should not be duplicated" do
        @post.received_actions.count.should == 2
      end

      it "should initialize follower count" do
        @post.reload.follower_count.should == 2
      end
    end

    describe "where posting to self" do
      before do
        @post = Factory(:self_post)
      end

      it "should not be duplicated" do
        @post.received_actions.count.should == 1
      end

      it "should initialize follower count" do
        @post.reload.follower_count.should == 1
      end
    end

    describe "where building the post" do
      before do
        user = Factory(:user)
        @post = Post.new :text => "Testing",
                         :author => user,
                         :owner  => user,
                         :user_author => user
        @post.save!
      end

      it "should not be duplicated" do
        @post.received_actions.count.should == 1
      end
    end
  end
end

Version data entries

66 entries across 66 versions & 2 rubygems

Version Path
social_stream-2.2.2 base/spec/models/activity_action_spec.rb
social_stream-base-2.2.2 spec/models/activity_action_spec.rb
social_stream-2.2.1 base/spec/models/activity_action_spec.rb
social_stream-base-2.2.1 spec/models/activity_action_spec.rb
social_stream-2.2.0 base/spec/models/activity_action_spec.rb
social_stream-base-2.2.0 spec/models/activity_action_spec.rb
social_stream-2.1.1 base/spec/models/activity_action_spec.rb
social_stream-1.1.12 base/spec/models/activity_action_spec.rb
social_stream-base-1.1.11 spec/models/activity_action_spec.rb
social_stream-2.1.0 base/spec/models/activity_action_spec.rb
social_stream-base-2.1.0 spec/models/activity_action_spec.rb
social_stream-2.0.4 base/spec/models/activity_action_spec.rb
social_stream-base-2.0.4 spec/models/activity_action_spec.rb
social_stream-2.0.3 base/spec/models/activity_action_spec.rb
social_stream-base-2.0.3 spec/models/activity_action_spec.rb
social_stream-1.1.11 base/spec/models/activity_action_spec.rb
social_stream-base-1.1.10 spec/models/activity_action_spec.rb
social_stream-1.1.10 base/spec/models/activity_action_spec.rb
social_stream-base-1.1.9 spec/models/activity_action_spec.rb
social_stream-1.1.9 base/spec/models/activity_action_spec.rb