Sha256: 5e5ea50c2a383e97bc20a2a15cabfa6c34f1f4c8df1098c48aafc0ca35ac53ca

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 KB

Contents

require_relative '../spec_helper'

class PrintSpec < Skr::TestCase

    # for debugging add a generate(pdf) to one of the specs
    def generate(pdf)
        Lanes::SystemSettings.config.logo = File.open(
            Pathname.new(__FILE__).dirname.join('../../fixtures/stockor.png')
        )
        begin
            File.open('/tmp/skr-test.tex', 'w'){|f| f.write pdf.as_latex    }
            File.open('/tmp/skr-test.pdf', 'w'){|f| f.write pdf.as_pdf.read }
        rescue ErbLatex::LatexError=>e
            puts e.log.gsub(/^\*\n/,'')
            assert(false)
        end
    end

    it "can generate default invoice" do
        inv = skr_invoice(:tiny)
        inv.update_attributes amount_paid: inv.total - 2.22
        assert inv.update_attributes form: 'default'
        pdf = Skr::Print::Form.new('invoice', inv.hash_code)
        assert pdf.as_latex
    end

    it 'can generate labor invoice' do
        inv = skr_invoice(:tiny)
        assert inv.update_attributes form: 'labor'
        pdf = Skr::Print::Form.new('invoice', inv.hash_code)
        assert pdf.as_latex
    end

    it 'can generate sales order' do
        so = skr_sales_order(:tiny)
        pdf = Skr::Print::Form.new('sales-order', so.hash_code)
        assert pdf.as_latex
    end

    it 'can generate checks' do
        pymnt = skr_payment(:bigco)
        pdf = Skr::Print::Form.new('payment', pymnt.hash_code)
        assert pdf.as_latex
    end


end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stockor-0.3.0 spec/server/print/form_spec.rb
stockor-0.2 spec/server/print/form_spec.rb