Class: CustomizedBelongsToTest
- Inherits:
-
ActionController::TestCase
- Object
- ActionController::TestCase
- CustomizedBelongsToTest
- Defined in:
- lib/vendor/plugins/inherited_resources/test/customized_belongs_to_test.rb
Instance Method Summary collapse
- #setup ⇒ Object
- #test_expose_the_resquested_school_with_chosen_instance_variable_on_create ⇒ Object
- #test_expose_the_resquested_school_with_chosen_instance_variable_on_destroy ⇒ Object
- #test_expose_the_resquested_school_with_chosen_instance_variable_on_edit ⇒ Object
- #test_expose_the_resquested_school_with_chosen_instance_variable_on_index ⇒ Object
- #test_expose_the_resquested_school_with_chosen_instance_variable_on_new ⇒ Object
- #test_expose_the_resquested_school_with_chosen_instance_variable_on_show ⇒ Object
- #test_expose_the_resquested_school_with_chosen_instance_variable_on_update ⇒ Object
Instance Method Details
#setup ⇒ Object
18 19 20 21 22 |
# File 'lib/vendor/plugins/inherited_resources/test/customized_belongs_to_test.rb', line 18 def setup GreatSchool.expects(:find_by_title!).with('nice').returns(mock_school(:professors => Professor)) @controller.stubs(:resource_url).returns('/') @controller.stubs(:collection_url).returns('/') end |
#test_expose_the_resquested_school_with_chosen_instance_variable_on_create ⇒ Object
48 49 50 51 52 |
# File 'lib/vendor/plugins/inherited_resources/test/customized_belongs_to_test.rb', line 48 def test_expose_the_resquested_school_with_chosen_instance_variable_on_create Professor.stubs(:build).returns(mock_professor(:save => true)) post :create, :school_title => 'nice' assert_equal mock_school, assigns(:great_school) end |
#test_expose_the_resquested_school_with_chosen_instance_variable_on_destroy ⇒ Object
60 61 62 63 64 |
# File 'lib/vendor/plugins/inherited_resources/test/customized_belongs_to_test.rb', line 60 def test_expose_the_resquested_school_with_chosen_instance_variable_on_destroy Professor.stubs(:find).returns(mock_professor(:destroy => true)) delete :destroy, :school_title => 'nice' assert_equal mock_school, assigns(:great_school) end |
#test_expose_the_resquested_school_with_chosen_instance_variable_on_edit ⇒ Object
42 43 44 45 46 |
# File 'lib/vendor/plugins/inherited_resources/test/customized_belongs_to_test.rb', line 42 def test_expose_the_resquested_school_with_chosen_instance_variable_on_edit Professor.stubs(:find).returns(mock_professor) get :edit, :school_title => 'nice' assert_equal mock_school, assigns(:great_school) end |
#test_expose_the_resquested_school_with_chosen_instance_variable_on_index ⇒ Object
24 25 26 27 28 |
# File 'lib/vendor/plugins/inherited_resources/test/customized_belongs_to_test.rb', line 24 def test_expose_the_resquested_school_with_chosen_instance_variable_on_index Professor.stubs(:find).returns([mock_professor]) get :index, :school_title => 'nice' assert_equal mock_school, assigns(:great_school) end |
#test_expose_the_resquested_school_with_chosen_instance_variable_on_new ⇒ Object
36 37 38 39 40 |
# File 'lib/vendor/plugins/inherited_resources/test/customized_belongs_to_test.rb', line 36 def test_expose_the_resquested_school_with_chosen_instance_variable_on_new Professor.stubs(:build).returns(mock_professor) get :new, :school_title => 'nice' assert_equal mock_school, assigns(:great_school) end |
#test_expose_the_resquested_school_with_chosen_instance_variable_on_show ⇒ Object
30 31 32 33 34 |
# File 'lib/vendor/plugins/inherited_resources/test/customized_belongs_to_test.rb', line 30 def test_expose_the_resquested_school_with_chosen_instance_variable_on_show Professor.stubs(:find).returns(mock_professor) get :show, :school_title => 'nice' assert_equal mock_school, assigns(:great_school) end |
#test_expose_the_resquested_school_with_chosen_instance_variable_on_update ⇒ Object
54 55 56 57 58 |
# File 'lib/vendor/plugins/inherited_resources/test/customized_belongs_to_test.rb', line 54 def test_expose_the_resquested_school_with_chosen_instance_variable_on_update Professor.stubs(:find).returns(mock_professor(:update_attributes => true)) put :update, :school_title => 'nice' assert_equal mock_school, assigns(:great_school) end |