Class: DefaultsTest
- Inherits:
-
ActionController::TestCase
- Object
- ActionController::TestCase
- DefaultsTest
- Defined in:
- lib/vendor/plugins/inherited_resources/test/defaults_test.rb
Instance Method Summary collapse
- #setup ⇒ Object
- #test_expose_a_new_painter ⇒ Object
- #test_expose_a_newly_create_painter_when_saved_with_success ⇒ Object
- #test_expose_all_painters_as_instance_variable ⇒ Object
- #test_expose_the_resquested_painter_on_edit ⇒ Object
- #test_expose_the_resquested_painter_on_show ⇒ Object
- #test_the_resquested_painter_is_destroyed ⇒ Object
- #test_update_the_requested_object ⇒ Object
Instance Method Details
#setup ⇒ Object
15 16 17 18 |
# File 'lib/vendor/plugins/inherited_resources/test/defaults_test.rb', line 15 def setup @controller.stubs(:resource_url).returns('/') @controller.stubs(:collection_url).returns('/') end |
#test_expose_a_new_painter ⇒ Object
32 33 34 35 36 |
# File 'lib/vendor/plugins/inherited_resources/test/defaults_test.rb', line 32 def test_expose_a_new_painter Malarz.expects(:new).returns(mock_painter) get :new assert_equal mock_painter, assigns(:malarz) end |
#test_expose_a_newly_create_painter_when_saved_with_success ⇒ Object
45 46 47 48 49 |
# File 'lib/vendor/plugins/inherited_resources/test/defaults_test.rb', line 45 def test_expose_a_newly_create_painter_when_saved_with_success Malarz.expects(:new).with({'these' => 'params'}).returns(mock_painter(:save => true)) post :create, :malarz => {:these => 'params'} assert_equal mock_painter, assigns(:malarz) end |
#test_expose_all_painters_as_instance_variable ⇒ Object
20 21 22 23 24 |
# File 'lib/vendor/plugins/inherited_resources/test/defaults_test.rb', line 20 def test_expose_all_painters_as_instance_variable Malarz.expects(:find).with(:all).returns([mock_painter]) get :index assert_equal [mock_painter], assigns(:malarze) end |
#test_expose_the_resquested_painter_on_edit ⇒ Object
38 39 40 41 42 43 |
# File 'lib/vendor/plugins/inherited_resources/test/defaults_test.rb', line 38 def test_expose_the_resquested_painter_on_edit Malarz.expects(:find).with('42').returns(mock_painter) get :edit, :id => '42' assert_response :success assert_equal mock_painter, assigns(:malarz) end |
#test_expose_the_resquested_painter_on_show ⇒ Object
26 27 28 29 30 |
# File 'lib/vendor/plugins/inherited_resources/test/defaults_test.rb', line 26 def test_expose_the_resquested_painter_on_show Malarz.expects(:find).with('42').returns(mock_painter) get :show, :id => '42' assert_equal mock_painter, assigns(:malarz) end |
#test_the_resquested_painter_is_destroyed ⇒ Object
58 59 60 61 62 63 |
# File 'lib/vendor/plugins/inherited_resources/test/defaults_test.rb', line 58 def test_the_resquested_painter_is_destroyed Malarz.expects(:find).with('42').returns(mock_painter) mock_painter.expects(:destroy) delete :destroy, :id => '42' assert_equal mock_painter, assigns(:malarz) end |
#test_update_the_requested_object ⇒ Object
51 52 53 54 55 56 |
# File 'lib/vendor/plugins/inherited_resources/test/defaults_test.rb', line 51 def test_update_the_requested_object Malarz.expects(:find).with('42').returns(mock_painter) mock_painter.expects(:update_attributes).with({'these' => 'params'}).returns(true) put :update, :id => '42', :malarz => {:these => 'params'} assert_equal mock_painter, assigns(:malarz) end |