Posts in ruby

Testing File Uploads in Rails Without Fixtures

While working on some functional tests for a controller, I needed to be able to test uploading a file. Fairly standard, but in this case I didn’t want to just use fixture_file_upload as the related objects were being created by Machinist from a blueprint. That’s where Rack::Test comes in. Rack::Test::UploadFile allows you to post a Tempfile given its path and content type. Perfect! No fixtures needed.

written in ruby Read on →