Renamed helpers to correspond to renamed Controller classes.
[merb_radiant.git] / radiant_specs / test / functional / admin / .svn / text-base / layout_controller_test.rb.svn-base
blob0367c717740e9a1056d100fc9462fa8d613e83cc
1 require File.dirname(__FILE__) + '/../../test_helper'
2 require 'admin/layout_controller'
4 # Re-raise errors caught by the controller.
5 class Admin::LayoutController; def rescue_action(e) raise e end; end
7 class Admin::LayoutControllerTest < Test::Unit::TestCase
8   fixtures :users, :layouts
9   test_helper :users, :layouts, :login
10   
11   def setup
12     @controller = Admin::LayoutController.new
13     @request = ActionController::TestRequest.new
14     @response = ActionController::TestResponse.new
15     login_as(:developer)
16   end
18   def test_ancestors
19     assert Admin::LayoutController.ancestors.include?(Admin::AbstractModelController)
20   end
21   
22   [:index, :new, :edit, :remove].each do |action|
23     define_method "test_#{action}_action_allowed_if_admin" do
24       login_as(:admin)
25       get action, { :id => 1 }
26       assert_response :success, "action: #{action}"
27     end
28     
29     define_method "test_#{action}_action__allowed_if_developer" do
30       get action, { :id => 1 }
31       assert_response :success, "action: #{action}"
32     end
33     
34     define_method "test_#{action}_action__not_allowed_if_other" do
35       login_as(:existing)
36       get action, { :id => 1 }
37       assert_redirected_to page_index_url, "action: #{action}"
38       assert_match /privileges/, flash[:error], "action: #{action}"
39     end
40   end
41   
42 end