Note that the Rails testing framework might be the only place that performs a
requirefor classes and libraries that are needed by your application. End result: your tests pass, but your application doesn’t work. For all the testing frameworks and methodologies, nothing beats the ol’ “click through” for peace of mind.
Flexmock: When using Flexmock, you are must specify that the mock is called at least
once, or your assertions might erroneously pass. Example:
<code> # Will pass even if :monkey is never called! my_flex_mock.should_receive(:monkey!) # Will fail if :monkey is not called once my_flex_mock.should_receive(:monkey!).once </code>
- Rspec syntax: old vs. new — the new style for
shouldassertions is a “multi word” style rather than “under_score_word”. Example:
<code> # Old style: underscored word monkey.should_be_nil # New style: multi word, multi method monkey.should be_nil </code>
has_manygotcha: Many already know this, but for a
has_manyrelationship, the append method (
<<) performs a save if the subject exists in the database already. In a test, you might need to perform a
monkey_wrangler.reloadto pick up all of the changes after a
monkey_wrangler.monkeys << baboon
- We are developing a Rails + AJAX wizard framework. Stay tuned!
Ask for Help
- Any concerns or issues regarding performing many AJAX requests over HTTPS?
- The main concern shared by the group was performance. Any other issues that people know of?
- It turns out that the has_many :through order dependency issue we described was our fault.