开发者

What RSpec tests should I write for this stand a lone Ruby application?

开发者 https://www.devze.com 2023-03-17 00:02 出处:网络
I have a small ruby app with one model, the model uses ActiveRecord & the find_by_sql method as the query is a little complex, it loops over the results and produces a CSV file, this file is then

I have a small ruby app with one model, the model uses ActiveRecord & the find_by_sql method as the query is a little complex, it loops over the results and produces a CSV file, this file is then uploaded to a remote FTP server.

Just wondering what are the RSpec tests that I should consider writing for t开发者_如何学Gohis non-rails app?

First time writing non-rails tests and have been hit with "testers block" :-)

Thanks!


Here's a list of things I would likely test for.

  1. Test that the application can connect to the FTP server and upload a trivial file.
  2. Test the query with various points of data.
  3. Test the CSV generation with irregular data (a forgotten field and other PEBCAK errors)
  4. Test that the CSV file contains all data.
  5. Test that the application responds gracefully (or as intended) in the event of a failure.

Posting any code or the query itself would allow us to offer much better advice.

0

精彩评论

暂无评论...
验证码 换一张
取 消