Sha256: 94f62fd27b2f95daa4132d0c34f9d9a585900f9d574a112e73afe47809a587c5
Contents?: true
Size: 995 Bytes
Versions: 1
Compression:
Stored size: 995 Bytes
Contents
def create_forum!(extra_attributes={}) attributes = { :title => "Welcome to Forem!", :description => "A placeholder forum." }.merge!(extra_attributes) @forum = Forem::Forum.create!(attributes) end def create_topic!(extra_attributes={}) attributes = { :subject => "FIRST TOPIC", :posts_attributes => { "0" => { :text => "omgomgomg", :user => User.first } } }.merge!(extra_attributes) create_forum! unless @forum @topic = @forum.topics.create(attributes) @post = @topic.posts.first @post.user = @user || create_user! @post.save! @topic end def create_user!(extra_attributes={}) attributes = { :login => "forem_user" }.merge!(extra_attributes) User.create!(attributes) end def create_post!(extra_attributes={}) attributes = { :text => "This is a brand new post!", :user => @user || create_user! }.merge!(extra_attributes) create_topic! unless @topic @post = @topic.posts.create!(attributes) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
forem-0.0.1 | spec/support/factories.rb |