Sha256: 76ec6c2440b27c15d4aa7e3289401e40fe200bb251917127f29cc54887f21cfd
Contents?: true
Size: 1.75 KB
Versions: 6
Compression:
Stored size: 1.75 KB
Contents
require 'helper' class ConfigurationTest < Test::Unit::TestCase context "Default configuration" do setup do Wisepdf::Configuration.reset! end should 'read default configuration' do assert_equal "UTF-8", Wisepdf::Configuration.options[:encoding] assert_equal false, Wisepdf::Configuration.options[:use_xserver] end if RbConfig::CONFIG['target_os'] != 'mingw32' should 'try to find wkhtmltopdf if not on windows' do path = (defined?(Bundler) ? `bundle exec which wkhtmltopdf` : `which wkhtmltopdf`).chomp assert_equal path, Wisepdf::Configuration.wkhtmltopdf end end end context "Configuration" do setup do Wisepdf::Configuration.reset! end should 'accept and override default configuration' do Wisepdf::Configuration.configure do |config| config.wkhtmltopdf = '/path/to/wkhtmltopdf' config.options = { :layout => "layout.html", :use_xserver => true, :footer => { :right => "#{Date.today.year}", :font_size => 8, :spacing => 8 }, :margin => { :bottom => 15 } } end assert_equal '/path/to/wkhtmltopdf', Wisepdf::Configuration.wkhtmltopdf assert_equal 'layout.html', Wisepdf::Configuration.options[:layout] assert_equal true, Wisepdf::Configuration.options[:use_xserver] assert_equal "#{Date.today.year}", Wisepdf::Configuration.options[:footer][:right] assert_equal 8, Wisepdf::Configuration.options[:footer][:font_size] assert_equal 8, Wisepdf::Configuration.options[:footer][:spacing] assert_equal 15, Wisepdf::Configuration.options[:margin][:bottom] end end end
Version data entries
6 entries across 6 versions & 1 rubygems