Sha256: b2c7cccc52e0510dd995ce417e30446e9f706f6d1d807837f26de4298c2a9048

Contents?: true

Size: 1.87 KB

Versions: 2

Compression:

Stored size: 1.87 KB

Contents

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

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

class WelcomeControllerTest < ActionController::TestCase
  main_scenario
  
  def setup
    @controller = WelcomeController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
    @request.session[:user_id] = 1000001
  end
  
  def test_index_redirect_to_login
    @request.session[:user_id] = nil
    get :index
    assert_response :redirect
    assert_redirected_to :controller => 'user', :action => :login
  end
  
  def test_index_first_time
    Work.delete_all
    Estimate.delete_all
    TaskFile.delete_all
    Task.delete_all
    ActiveRecord::Base.connection.execute("DELETE FROM work_lock_subscriptions")
    Project.delete_all
    get :index
    assert_response :redirect
    assert_redirected_to :controller => 'projects', :action => :new
  end
  
  def test_index_active_period
    Work.delete(works(:started).id)
    get :index
    assert_response :redirect
    assert_redirected_to :controller => 'periods', :action => :show, :id => periods(:ancient)
  end
  
  def test_index_list_started
    get :index
    assert_response :redirect
    assert_redirected_to :controller => 'tasks', :action => :list_started
  end
  
  def test_index_no_active_sprints
    periods(:active).update_attributes!(:end_on => (Date.today - 1))
    Work.delete(works(:started).id)
    tasks(:first).finish(Task::COMPLETED, true)
    tasks(:another).finish(Task::COMPLETED, true)
    tasks(:started).finish(Task::COMPLETED, true)
    tasks(:subsubtask).finish(Task::COMPLETED, true)
    tasks(:in_ancient).finish(Task::COMPLETED, true)
    get :index
    assert_response :redirect
    assert_redirected_to :controller => 'projects', :action => :show, :id => 1
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
backlog-0.37.2 test/functional/welcome_controller_test.rb
backlog-0.37.1 test/functional/welcome_controller_test.rb