Sha256: f41ecaa49199293a3a0a31d5fa08e64ab7c0d6a4c9beb068dde1e434c6c968d6

Contents?: true

Size: 931 Bytes

Versions: 5

Compression:

Stored size: 931 Bytes

Contents

require 'spec_helper'

describe Zebra::PrintJob do
  it "receives the name of a printer" do
    expect(described_class.new("Zebra").printer).to eq 'Zebra'
  end

  describe "#print" do
    let(:label) { Zebra::Zpl::Label.new(print_speed: 2) }
    let(:zpl_string) { '^XA^FO50,50^FDHello, Zebra^FS^XZ' }
    let(:ip) { '127.0.0.1' }

    subject(:print_job) { described_class.new "Zebra" }

    before { allow(print_job).to receive(:`) { true } }

    it "creates a cups print job with the correct arguments" do
      print_job.print label, ip
    end

    it "prints the label" do
      expect(print_job).to receive(:system).with(/r?lpr? -(h|H) 127.0.0.1 -(d|P) Zebra.*/).at_least(:once)
      print_job.print label, ip
    end

    it "can print from a ZPL string" do
      expect(print_job).to receive(:system).with(/r?lpr? -(h|H) 127.0.0.1 -(d|P) Zebra.*/).at_least(:once)
      print_job.print zpl_string, ip
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
zebra-zpl-1.1.4 spec/zebra/print_job_spec.rb
zebra-zpl-1.1.3 spec/zebra/print_job_spec.rb
zebra-zpl-1.1.2 spec/zebra/print_job_spec.rb
zebra-zpl-1.1.1 spec/zebra/print_job_spec.rb
zebra-zpl-1.1.0 spec/zebra/print_job_spec.rb