Sha256: c7254a27f32a24988835ddc213e57160a494f338e81bd2f6ac1f4b5e513952b0

Contents?: true

Size: 1.79 KB

Versions: 17

Compression:

Stored size: 1.79 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'
require 'backlogs_controller'

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

class BacklogsControllerTest < Test::Unit::TestCase
  fixtures :parties, :users, :groups, :backlogs, :periods, :tasks, :works, :estimates

  def setup
    @user_controller = UserController.new
    @controller = BacklogsController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
    @request.session[:user_id] = 1000001
  end

  def test_index
    get :index
    assert_response :redirect
    assert_redirected_to :controller => 'tasks', :action => :list_started
  end

  def test_show
    get :show, :id => 1

    assert_response :redirect
    assert_redirected_to :controller => 'periods', :action => :show
  end

  def test_new
    get :new

    assert_response :success
    assert_template 'new'

    assert_not_nil assigns(:backlog)
  end

  def test_create
    num_backlogs = Backlog.count
    @request.session[:user_id] = 1000001
    post :create, :backlog => {:name => 'house work'}

    assert_response :redirect
    assert_redirected_to :action => :show

    assert_equal num_backlogs + 1, Backlog.count
  end

  def test_edit
    get :edit, :id => 1

    assert_response :success
    assert_template 'edit'

    assert_not_nil assigns(:backlog)
    assert assigns(:backlog).valid?
  end

  def test_update
    post :update, :id => 1
    assert_response :redirect
    assert_redirected_to :action => 'show', :id => 1
  end

  def test_destroy
    assert_not_nil Backlog.find(1)

    post :destroy, :id => 1
    assert_response :redirect
    assert_redirected_to :action => :index

    assert_raise(ActiveRecord::RecordNotFound) {
      Backlog.find(1)
    }
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
backlog-0.0.5 test/functional/backlogs_controller_test.rb
backlog-0.1.1 test/functional/backlogs_controller_test.rb
backlog-0.1.0 test/functional/backlogs_controller_test.rb
backlog-0.1.2 test/functional/backlogs_controller_test.rb
backlog-0.2.0 test/functional/backlogs_controller_test.rb
backlog-0.2.1 test/functional/backlogs_controller_test.rb
backlog-0.3.0 test/functional/backlogs_controller_test.rb
backlog-0.3.1 test/functional/backlogs_controller_test.rb
backlog-0.3.3 test/functional/backlogs_controller_test.rb
backlog-0.3.2 test/functional/backlogs_controller_test.rb
backlog-0.3.4 test/functional/backlogs_controller_test.rb
backlog-0.3.6 test/functional/backlogs_controller_test.rb
backlog-0.3.5 test/functional/backlogs_controller_test.rb
backlog-0.3.8 test/functional/backlogs_controller_test.rb
backlog-0.3.7 test/functional/backlogs_controller_test.rb
backlog-0.3.9 test/functional/backlogs_controller_test.rb
backlog-0.4.0 test/functional/backlogs_controller_test.rb