Sha256: fafb36054ec3aa573882e18560cfd51be7ffbd3a5ecfc1719abab0fa731a0330

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe ZebraPrinterDocument do
  context "language :epl2" do
    before :each do
      subject.language :epl2
    end

    it "language_processor is correct" do
      expect(subject.language_processor).to be_a Languages::Epl2
    end

    context "DSL" do
      [:text, :barcode, :position, :font, :rotate].each do |method|
        it "#{method.to_s}" do
          expect(subject).to respond_to method
        end
      end
    end

  end

  context "language :zpl2" do
    before :each do
      subject.language :zpl2
    end

    it "language_processor is correct" do
      expect(subject.language_processor).to be_a Languages::Zpl2
    end

    context "DSL" do
      [:text, :barcode, :position, :font, :rotate].each do |method|
        it "#{method.to_s}" do
          expect(subject).to respond_to method
        end
      end
    end
  end

  context "with data" do
    before :each do
      data = { :data_item_1 => 'data_item_1_value' }
      subject = ZebraPrinterDocument.new data
    end

    it "allows the data access as data" do
      expect(subject).to respond_to :data
    end
  end

  context "string coercion" do
    before :each do
      subject.language :zpl2
      subject.text 'hello world'
    end

    it "can be a string" do
      expect(subject.to_str).to include("^FDhello world^FS")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zebra_printer-0.9.0 spec/lib/zebra_printer_document_spec.rb