Sha256: 08aa606ee517ca051500f1aaa805eb7dd06e429c2e53393f6169bb84fb10f83d

Contents?: true

Size: 1.78 KB

Versions: 25

Compression:

Stored size: 1.78 KB

Contents

require 'spec_helper'

describe ActivityObjectProperty do
  describe "siblings" do
    it "should work" do
      holder, one, two, three = 4.times.map{ Factory(:post) }

      p = ActivityObjectProperty.create! activity_object_id: holder.activity_object_id,
                                         property_id:        one.activity_object_id

      p.siblings.should be_blank
      p.main.should be_true

      q = ActivityObjectProperty.create! activity_object_id: holder.activity_object_id,
                                         property_id:        two.activity_object_id

      p.siblings.should include(q)
      p.reload.main.should be_true
      q.main.should be_false

      r = ActivityObjectProperty.create! activity_object_id: holder.activity_object_id,
                                         property_id:        three.activity_object_id,
                                         main:               true

      r.siblings.should include(p)
      r.siblings.should include(q)

      p.reload.main.should be_false
      q.reload.main.should be_false
      r.main.should be_true
    end
  end

  context "with main_holder_object_ids" do
    it "should be created" do
      @holder = Factory(:post)

      prop = Post.create! text: "Text",
                          author: @holder.author,
                          main_holder_object_ids: [ @holder.activity_object_id ]

      @holder.posts.should include(prop)
      @holder.main_post.should eq(prop)
    end
  end

  context "with add_holder_post_id" do
    it "should be created" do
      @holder = Factory(:post)

      prop = Post.create! text: "Text",
                          author: @holder.author,
                          add_holder_post_id: @holder.id

      @holder.posts.should include(prop)
      @holder.main_post.should eq(prop)
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
social_stream-2.2.2 base/spec/models/activity_object_property_spec.rb
social_stream-base-2.2.2 spec/models/activity_object_property_spec.rb
social_stream-2.2.1 base/spec/models/activity_object_property_spec.rb
social_stream-base-2.2.1 spec/models/activity_object_property_spec.rb
social_stream-2.2.0 base/spec/models/activity_object_property_spec.rb
social_stream-base-2.2.0 spec/models/activity_object_property_spec.rb
social_stream-2.1.1 base/spec/models/activity_object_property_spec.rb
social_stream-2.1.0 base/spec/models/activity_object_property_spec.rb
social_stream-base-2.1.0 spec/models/activity_object_property_spec.rb
social_stream-2.0.4 base/spec/models/activity_object_property_spec.rb
social_stream-base-2.0.4 spec/models/activity_object_property_spec.rb
social_stream-2.0.3 base/spec/models/activity_object_property_spec.rb
social_stream-base-2.0.3 spec/models/activity_object_property_spec.rb
social_stream-2.0.2 base/spec/models/activity_object_property_spec.rb
social_stream-base-2.0.2 spec/models/activity_object_property_spec.rb
social_stream-2.0.1 base/spec/models/activity_object_property_spec.rb
social_stream-base-2.0.1 spec/models/activity_object_property_spec.rb
social_stream-2.0.0 base/spec/models/activity_object_property_spec.rb
social_stream-base-2.0.0 spec/models/activity_object_property_spec.rb
social_stream-2.0.0.beta3 base/spec/models/activity_object_property_spec.rb