The step definitions below allow you to write this in both Webrat and Capybara:
When I follow "Download as PDF"
Then I should get a response with content-type "application/pdf"
Then /^I should get a response with content-type "([^"]*)"$/ do |content_type|
page.response_headers['Content-Type'].should == content_type
end
Then /^I should get a response with content-type "([^"]*)"$/ do |content_type|
response.content_type.should == content_type
end
Unfortunatly this do...
Gallery of fonts you can use without much hassle in LaTeX. The license of the fonts vary, but are all free. Note that the fonts not necessarily are free to distribute, and some fonts are available for non-commercial use only.
If a controller action responds to other formats than HTML (XML, PDF, Excel, JSON, ...), you can reach that code in a controller spec like this:
describe UsersController do
describe '#index' do
it 'should be able to send an excel file' do
# stubs and expectations go here
get :index, :format => 'xls'
end
end
end
Remember that both the :format
parameter and the HTTP_ACCEPT
header can m...
We use RTeX for PDF exports.
While converting LaTeX to PDF, RTeX opens a temporary file which has problematic permissions: Both group and world can read those files.
Although the temp files should go away they sometimes live longer than one would expect.
We patched RTeX to fix this (and have more secure permissions). Place the code below into config/initializers/rtex.rb
This is an awesome gadget in your toolbox, even if your test coverage is great.
gem install ruby-debug
(Ruby 1.8) or gem install debugger
(Ruby 1.9)script/server --debugger
debugger
anywhere in your codeThe following counts all the lines in all *.rb
files in the app
directory. Run several of these commands to get a rough estimate of the LOC.
find app -name *.rb -exec wc {} \; | awk '{a+=$1;print a}' | tail -1
This may be awkward to set up, but will work once you're done.
Fun facts:
STOP SLAVE; RESET SLAVE;
and reset your my.cnf) and restart the MySQL daemon.Create replication user
: In the MySQL shell:
CREATE USER 'replicator'@'%' IDENTI...
An example of the conundrum of transferring print documents to the web, one that has become legendary in some circles, is the film screenplay.
jsPDF is an open-source library for generating PDF documents using nothing but Javascript. You can use it in a Firefox extension, in Server Side Javascript and with Data URIs in some browsers.
Ruby Ghostscript (RGhost) is a library for document developers wanting a quick and easy way to generate pdf files. It's optimized to work with larger documents.
Pretty print your Ruby objects with style -- in full color and with proper indentation
Simple shell utility to convert html to pdf using the webkit rendering engine, and qt.
We're excited to announce PDFKit, an open source library that makes working with wkhtmltopdf a snap.