RSpec send_file testing
From Googling around, it appears that render will also be called at some point .. but with no template, will cause an error. The solution seems to be to stub it out as well: controller.stub!(:render)
From Googling around, it appears that render will also be called at some point .. but with no template, will cause an error. The solution seems to be to stub it out as well: controller.stub!(:render)
The browser should load style.css on its own, so you can serve that as a route: app.get(‘/style.css’, function(req, res) { res.sendFile(__dirname + “https://stackoverflow.com/” + “https://stackoverflow.com/questions/38757235/style.css”); }); However, this would get very cumbersome very quickly as you add more files. Express provides a built in way to serve static files: https://expressjs.com/en/starter/static-files.html const express = require(“express”); const … Read more
send_data(_data_, options = {}) send_file(_path_, options = {}) Main difference here is that you pass DATA (binary code or whatever) with send_data or file PATH with send_file. So you can generate some data and send it as an inline text or as an attachment without generating file on your server via send_data. Or you can … Read more