fix tests

This commit is contained in:
albert
2013-02-18 20:59:45 -05:00
parent 8a46836238
commit e3ddafa265
3 changed files with 19 additions and 17 deletions

View File

@@ -2,21 +2,23 @@ module AdvertisementsHelper
def render_advertisement(ad_type) def render_advertisement(ad_type)
if Danbooru.config.can_see_ads?(CurrentUser.user) if Danbooru.config.can_see_ads?(CurrentUser.user)
@advertisement = Advertisement.find(:first, :conditions => ["ad_type = ? AND status = 'active'", ad_type], :order => "random()") @advertisement = Advertisement.find(:first, :conditions => ["ad_type = ? AND status = 'active'", ad_type], :order => "random()")
content_tag( if @advertisement
"div", content_tag(
link_to( "div",
image_tag( link_to(
@advertisement.image_url, image_tag(
:alt => "Advertisement", @advertisement.image_url,
:width => @advertisement.width, :alt => "Advertisement",
:height => @advertisement.height :width => @advertisement.width,
), :height => @advertisement.height
advertisement_hits_path(:advertisement_id => @advertisement.id), ),
:remote => true, advertisement_hits_path(:advertisement_id => @advertisement.id),
:method => :post :remote => true,
), :method => :post
:style => "margin-bottom: 1em;" ),
) :style => "margin-bottom: 1em;"
)
end
else else
"" ""
end end

View File

@@ -7,7 +7,6 @@
class TagSetPresenter < Presenter class TagSetPresenter < Presenter
def initialize(tags) def initialize(tags)
@tags = tags @tags = tags
puts @tags.inspect
end end
def tag_list_html(template, options = {}) def tag_list_html(template, options = {})

View File

@@ -76,7 +76,8 @@ class ForumPostsControllerTest < ActionController::TestCase
context "destroy action" do context "destroy action" do
should "destroy the posts" do should "destroy the posts" do
post :destroy, {:id => @forum_post.id}, {:user_id => @user.id} CurrentUser.user = @mod
post :destroy, {:id => @forum_post.id}, {:user_id => @mod.id}
assert_redirected_to(forum_post_path(@forum_post)) assert_redirected_to(forum_post_path(@forum_post))
@forum_post.reload @forum_post.reload
assert_equal(true, @forum_post.is_deleted?) assert_equal(true, @forum_post.is_deleted?)