Sha256: 91da39d1b32f771562123de5a5608c1c9e8378178bcf93513c04a41bed389bd8

Contents?: true

Size: 1.57 KB

Versions: 37

Compression:

Stored size: 1.57 KB

Contents

# Helpers for building the post activity
#
class ActivityObjectSpecHelper < ActiveRecord::Base
  set_table_name "activity_objects"
end

class PostSpecHelper < ActiveRecord::Base
  set_table_name "posts"

  belongs_to :activity_object_spec_helper, :foreign_key => "activity_object_id"
end

Factory.define :activity_object_spec_helper do |a|
  a.object_type "Post"
end

Factory.define :post_spec_helper do |p|
  p.association :activity_object_spec_helper
  p.text "Post spec helper"
end

#
## End of helpers

Factory.define :activity do |a|
  a.contact { Factory(:friend).contact }
  a.activity_verb { ActivityVerb["post"] }
  a.relation_ids  { |b| Array(b.sender.relation_custom('friend').id) }
  a.activity_object_ids { Array(Factory(:post_spec_helper).activity_object_spec_helper.id) }
end

Factory.define :self_activity, :parent => :activity do |a|
  a.contact { Factory(:self_contact) }
  a.relation_ids  { |b| Array(b.sender.relation_custom('friend').id) }
end

Factory.define :public_activity, :parent => :activity do |a|
  a.relation_ids  { |b| Array(b.sender.relation_public.id) }
end

Factory.define :like_activity, :class => 'Activity' do |a|
  a.association :parent, :factory => :activity
  a.contact { |b| Factory(:friend, :sender => b.parent.sender).receiver.contact_to!(b.parent.sender) }
  a.activity_verb { ActivityVerb["like"] }
  a.relation_ids  { |b| b.parent.relation_ids }
  a.after_build{ |b| b.activity_object_ids = b.parent.activity_object_ids }
end


Factory.define :fan_activity, :parent => :public_activity do |a|
  a.activity_objects { |b| Array(b.receiver.activity_object) }
end

Version data entries

37 entries across 37 versions & 4 rubygems

Version Path
vkhater-social_stream-0.16.3.3 base/spec/factories/activity.rb
vkhater-social_stream-base-0.11.2 spec/factories/activity.rb
social_stream-0.17.1 base/spec/factories/activity.rb
social_stream-base-0.12.1 spec/factories/activity.rb
social_stream-0.17.0 base/spec/factories/activity.rb
social_stream-base-0.12.0 spec/factories/activity.rb
social_stream-0.16.3 base/spec/factories/activity.rb
social_stream-base-0.11.2 spec/factories/activity.rb
social_stream-0.16.2 base/spec/factories/activity.rb
social_stream-base-0.11.1 spec/factories/activity.rb
social_stream-0.16.1 base/spec/factories/activity.rb
social_stream-base-0.11.0 spec/factories/activity.rb
social_stream-0.15.8 base/spec/factories/activity.rb
social_stream-base-0.10.11 spec/factories/activity.rb
social_stream-0.15.7 base/spec/factories/activity.rb
social_stream-base-0.10.10 spec/factories/activity.rb
social_stream-0.15.6 base/spec/factories/activity.rb
social_stream-base-0.10.9 spec/factories/activity.rb
social_stream-0.15.5 base/spec/factories/activity.rb
social_stream-base-0.10.8 spec/factories/activity.rb