Created
September 29, 2010 17:26
-
-
Save dreamr/603150 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module FactoryHelper | |
def rand_obj(array, obj) | |
array.delete(obj) | |
array[rand(array.size-1)] | |
end | |
def generate_name | |
name = Faker::Name.name.split(' ') | |
[name[0], name[1]] | |
end | |
def create_user | |
User.any_instance.stubs(:deliver_signup_email) | |
user = Community.default_community.users.create( Factory.attributes_for(:user) ) | |
user | |
end | |
def create_feed_item | |
end | |
def build_valid_block_with_items(type) | |
case type | |
when :picoticker | |
build_valid_picoticker_block_with_items | |
end | |
end | |
private | |
def build_valid_picoticker_block_with_items | |
PicotickerBlock.any_instance.stubs(:publish_favicon_request) | |
PicotickerBlock.any_instance.stubs(:pull_picoticker_items!) | |
block = Factory( :picoticker_block, | |
:user => @user, | |
:community => Community.default_community, | |
:folder => @user.dashboard | |
) | |
(1..10).each do | |
Factory(:item, | |
:user => @user, | |
:community => Community.default_community, | |
:block => block.block, | |
:parent => block | |
) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment