Skip to content

Instantly share code, notes, and snippets.

@ZenCocoon
Created August 8, 2013 01:01
Show Gist options
  • Save ZenCocoon/6180529 to your computer and use it in GitHub Desktop.
Save ZenCocoon/6180529 to your computer and use it in GitHub Desktop.
Test controller with file upload
describe "POST to #create" do
# Will use the file located at rspec/fixtures/files/test-document.pdf
let(:attachement) { fixture_file_upload('/files/test-document.pdf', "text/pdf") }
before do
post :create, attachment: {title: "Attachment Title", attachment: file_attachment}
end
it {should redirect_to some_path }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment