Class: CustomizedBelongsToTest

Inherits:
ActionController::TestCase
  • Object
show all
Defined in:
lib/vendor/plugins/inherited_resources/test/customized_belongs_to_test.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



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_createObject



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_destroyObject



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_editObject



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_indexObject



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_newObject



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_showObject



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_updateObject



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