Sha256: 77418dd5adff15a98ff34d638f22fbf088e3df6ad1d24d8ac7973be55250945b

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

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

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

describe Admin::ResourcesController do
  before do
    @request.session = { :user => users(:tobi).id }
  end

  def test_list
    get :list
    assert_response :success
    assert_template 'index'
    assert_template_has 'resources'
    assert_not_nil assigns(:resources)
    assert_not_nil assigns(:resources_pages)
  end

  def test_destroy
    res_id = resources(:resource1).id
    assert_not_nil Resource.find(res_id)

    get :destroy, :id => res_id
    assert_response :success
    assert_template 'destroy'
    assert_not_nil assigns(:file)

    post :destroy, :id => res_id
    assert_response 302
    follow_redirect
    assert_template 'index'
  end

  def test_new
    get :new
    assert_response :success
    assert_template 'new'
  end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
typo-5.0.3.98.1 spec/controllers/admin/resources_controller_spec.rb
typo-5.0.3.98 spec/controllers/admin/resources_controller_spec.rb
typo-5.1.1 spec/controllers/admin/resources_controller_spec.rb
typo-5.1.2 spec/controllers/admin/resources_controller_spec.rb
typo-5.1.3 spec/controllers/admin/resources_controller_spec.rb
typo-5.1 spec/controllers/admin/resources_controller_spec.rb