Class: BelongsToErrorsTest

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

Instance Method Summary collapse

Instance Method Details

#test_belongs_to_raise_errors_with_invalid_argumentsObject



90
91
92
93
94
95
96
97
98
# File 'lib/vendor/plugins/inherited_resources/test/class_methods_test.rb', line 90

def test_belongs_to_raise_errors_with_invalid_arguments
  assert_raise ArgumentError do
    DeansController.send(:belongs_to)
  end

  assert_raise ArgumentError do
    DeansController.send(:belongs_to, :nice, :invalid_key => '')
  end
end

#test_belongs_to_raises_an_error_when_multiple_associations_are_given_with_optionsObject



100
101
102
103
104
# File 'lib/vendor/plugins/inherited_resources/test/class_methods_test.rb', line 100

def test_belongs_to_raises_an_error_when_multiple_associations_are_given_with_options
  assert_raise ArgumentError do
    DeansController.send(:belongs_to, :arguments, :with_options, :parent_class => Professor)
  end
end

#test_url_helpers_are_recreated_just_once_when_belongs_to_is_called_with_blockObject



106
107
108
109
110
111
112
113
# File 'lib/vendor/plugins/inherited_resources/test/class_methods_test.rb', line 106

def test_url_helpers_are_recreated_just_once_when_belongs_to_is_called_with_block
  DeansController.expects(:create_resources_url_helpers!).returns(true).once
  DeansController.send(:belongs_to, :school) do
    belongs_to :association
  end
ensure
  DeansController.send(:parents_symbols=, [:school])
end

#test_url_helpers_are_recreated_just_once_when_belongs_to_is_called_with_multiple_blocksObject



115
116
117
118
119
120
121
122
123
124
# File 'lib/vendor/plugins/inherited_resources/test/class_methods_test.rb', line 115

def test_url_helpers_are_recreated_just_once_when_belongs_to_is_called_with_multiple_blocks
  DeansController.expects(:create_resources_url_helpers!).returns(true).once
  DeansController.send(:belongs_to, :school) do
    belongs_to :association do
      belongs_to :nested
    end
  end
ensure
  DeansController.send(:parents_symbols=, [:school])
end