Asserts in Rails from models or controllers? -


Is there an inherent way of specifying them in the railway which will throw an exception if an irreversible development and breakdown during testing is ?

EDIT: To be clear, I am looking to claim that it can be placed in models or controllers, as it is to claim that you will use for unit tests. .

If you are writing a test many are doing such work but for assertiona in the main code, There is no one and you can easily roll your own.

environment.rb :

  Class Asset Filler & lt; Exceptions end DEF (message = 'intended meaning') unless block_life is there?  

and your environment / production There is at least overhead to create a no-op in RB

  DEF emphasis (message = 'indicting failed') End  

Then, in your code, you can emphasize the content of your heart:

  emphasis (value == expected_value} says ('no value was expected') {value = = Expected_value}  

If value is not equal expected_value and you are not running in production, an exception will be raised.


Comments