diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb new file mode 100644 index 0000000..44874d7 --- /dev/null +++ b/test/functional/projects_controller_test.rb @@ -0,0 +1,23 @@ +require File.dirname(__FILE__) + '/../test_helper' +require_dependency 'projects_controller' + +class ProjectsControllerTest < ActionController::TestCase + def setup + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + + def test_no_redirect_to_landing_page + @project = Project.generate!(:identifier => 'demo') + get :show, :id => @project.identifier + assert_response :success + assert_template 'show' + end + + def test_redirect_to_landing_page + @project = Project.generate!(:identifier => 'demo', + :landing_page => "http://#{@request.host}/projects/demo/news") + get :show, :id => @project.identifier + assert_redirected_to "http://#{@request.host}/projects/#{@project.identifier}/news" + end +end