Class | FeedbacksControllerTest
In: | test/functional/feedbacks_controller_test.rb
Parent: | Test::Unit::TestCase

### Methods

setup test_destroy test_edit

### Public Instance methods

setup()

[Source]

        # File test/functional/feedbacks_controller_test.rb, line 24
    24:   def setup
    25:     logger.debug "Test Case: #{name}"
    26:     @controller = FeedbacksController.new
    27:     @request    = ActionController::TestRequest.new
    28:     @response   = ActionController::TestResponse.new
    29:     @andy = users(:andy) # admin
    30:     @george = users(:george) # central admin
    31:     @tony = users(:tony) # user
    32:     @emails = ActionMailer::Base::deliveries
    33:     @emails.clear
    34:   end

test_destroy()

[Source]

        # File test/functional/feedbacks_controller_test.rb, line 41
    41:   def test_destroy
    42:     feedback = Feedback.create(:email => 'x@adb.com',:text => 'test_show')
    43:     get :index
    44:     session['user'] = @andy
    45:     assert_nothing_raised {Feedback.find(feedback.id)}
    46:
    47:     post :destroy, :id => feedback.id
    48:     assert_unot_cadmin_message
    49:
    50:     # TODO cannot test this because the controller uses request.referer
    51:     #session['user'] = @george
    52:     #post :destroy, :id => feedback.id
    53:
    54:     #assert_response :redirect
    55:     #assert_redirected_to :action => 'list'
    56:
    57:     #assert_raise(ActiveRecord::RecordNotFound) {Feedback.find(feedback.id)}
    58:   end

test_edit()

[Source]

        # File test/functional/feedbacks_controller_test.rb, line 36
    36:   def test_edit
    37:     get :edit, :id => 999
    38:     assert_unot_cadmin_message
    39:   end

[Validate]