Sha256: cbcbeb112b8238fe63974c130c4bafe9250b60003cbb708b24798961fba14ec3

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 KB

Contents

require File.dirname(__FILE__) + '/../../test_helper'
require 'admin/resources_controller'

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

class Admin::ResourcesControllerTest < Test::Unit::TestCase
  fixtures :users, :resources

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

  def test_list
    get :list
    assert_success
    assert_rendered_file 'list'
    assert_template_has 'resources'
    assert_not_nil assigns(:resources)
    assert_not_nil assigns(:resources_pages)
  end

  def test_destroy
    assert_not_nil Resource.find(1)

    get :destroy, :id => 1
    assert_success
    assert_rendered_file 'destroy'
    assert_not_nil assigns(:file)

    post :destroy, :id => 1
    assert_response 302
    follow_redirect
    assert_rendered_file 'list'
  end

  def test_new
    get :new
    assert_success
    assert_rendered_file 'new'
  end

  def test_upload
    # unsure how to test upload constructs :'(
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
typo-3.99.0 test/functional/admin/resources_controller_test.rb
typo-3.99.2 test/functional/admin/resources_controller_test.rb
typo-3.99.3 test/functional/admin/resources_controller_test.rb
typo-3.99.1 test/functional/admin/resources_controller_test.rb
typo-4.0.2 test/functional/admin/resources_controller_test.rb
typo-4.0.1 test/functional/admin/resources_controller_test.rb
typo-3.99.4 test/functional/admin/resources_controller_test.rb
typo-4.0.0 test/functional/admin/resources_controller_test.rb
typo-4.0.3 test/functional/admin/resources_controller_test.rb