test/aliases_test.rb in josevalim-inherited_resources-0.5.2 vs test/aliases_test.rb in josevalim-inherited_resources-0.6.0

- old
+ new

@@ -1,7 +1,5 @@ -# Now we are going to test aliases defined in base.rb and if overwriting -# methods works properly. require File.dirname(__FILE__) + '/test_helper' class Student; def self.human_name; 'Student'; end end @@ -38,18 +36,13 @@ end end end -class AliasesBaseTest < TEST_CLASS +class AliasesTest < ActionController::TestCase + tests StudentsController - def setup - @controller = StudentsController.new - @controller.request = @request = ActionController::TestRequest.new - @controller.response = @response = ActionController::TestResponse.new - end - def test_assignments_before_calling_alias Student.stubs(:new).returns(mock_student) get :new assert_response :success assert_equal 'magical', assigns(:something) @@ -90,11 +83,11 @@ post :create assert_response :success assert_equal "I won't redirect!", @response.body end - def test_dumb_responder_with_quietly_receive_everything_on_failure + def test_dumb_responder_quietly_receives_everything_on_failure Student.stubs(:new).returns(mock_student(:save => false, :errors => [])) @controller.stubs(:resource_url).returns('http://test.host/') post :create assert_response :success assert_template :edit @@ -105,11 +98,12 @@ put :update assert_response :success assert_equal "I won't render!", @response.body end - def test_dumb_responder_with_quietly_receive_everything_on_success + def test_dumb_responder_quietly_receives_everything_on_success Student.stubs(:find).returns(mock_student(:update_attributes => true)) + @controller.stubs(:resource_url).returns('http://test.host/') put :update, :id => '42', :student => {:these => 'params'} assert_equal mock_student, assigns(:student) end def test_block_is_called_when_student_is_destroyed