Sha256: 882dee97eff085cb4fbd5209996eccda72fdce3f9b8c95b7f6fcadc1efc1038c

Contents?: true

Size: 1.62 KB

Versions: 3

Compression:

Stored size: 1.62 KB

Contents

require File.dirname(__FILE__) + '/../../test_helper'
require 'admin/feedback_controller'
require 'comment'
require 'trackback'

# Re-raise errors caught by the controller.
class Admin::FeedbackController; def rescue_action(e) raise e end; end

class Admin::FeedbackControllerTest < Test::Unit::TestCase
  fixtures :contents, :users, :resources, :text_filters,
           :blogs, :categorizations, :feedback, :blacklist_patterns, :categories

  def setup
    @controller = Admin::FeedbackController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
    @request.session = { :user_id => users(:tobi).id }
  end

  def test_index
    get :index

    assert_response :success
    assert_template 'list'
    assert_equal Feedback.count, assigns(:feedback).size
  end

  def test_list_unconfirmed
    get :index, :confirmed => 'f'

    assert_response :success
    assert_template 'list'

    assert_equal(Feedback.count(:conditions => ['blog_id = 1 AND status_confirmed = ?', false]),
                 assigns(:feedback).size)

  end

  def test_list_spam
    get :index, :published => 'f'

    assert_response :success
    assert_template 'list'

    assert_equal(Feedback.count(:conditions => ['blog_id = 1 AND published = ?', false]),
                 assigns(:feedback).size)
  end

  def test_list_unconfirmed_spam
    get :index, :published => 'f', :confirmed => 'f'

    assert_response :success
    assert_template 'list'

    assert_equal(Feedback.count(:conditions => ['blog_id = 1 AND published = ? AND status_confirmed = ?', false, false]),
                 assigns(:feedback).size)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
typo-5.0.1 test/functional/admin/feedback_controller_test.rb
typo-5.0.2 test/functional/admin/feedback_controller_test.rb
typo-5.0 test/functional/admin/feedback_controller_test.rb