Sha256: 7dfafbc0eceb4edaade8156880635085de8cb7ff83df9ce517923606df7f6e73
Contents?: true
Size: 1.64 KB
Versions: 3
Compression:
Stored size: 1.64 KB
Contents
require "spec_helper" RSpec.describe Vectory::Eps do shared_examples "converter" do |format| it "returns content of a chosen format" do to_format_method = "to_#{format}" content = described_class.from_path(input) .public_send(to_format_method) .content matcher = case format when "eps", "ps" then "be_eps" when "svg" then "be_svg" else "be_equivalent_to" end expect(content) .to public_send(matcher, File.read(reference)) end end describe "#to_ps" do let(:input) { "spec/examples/eps2ps/img.eps" } let(:reference) { "spec/examples/eps2ps/ref.ps" } it_behaves_like "converter", "ps" end describe "#to_svg" do let(:input) { "spec/examples/eps2svg/img.eps" } let(:reference) { "spec/examples/eps2svg/ref.svg" } it_behaves_like "converter", "svg" end describe "#to_emf" do let(:input) { "spec/examples/eps2emf/img.eps" } let(:reference) { "spec/examples/eps2emf/ref.emf" } it_behaves_like "converter", "emf" end describe "#mime" do let(:input) { "spec/examples/eps2emf/img.eps" } it "returns postscript" do expect(described_class.from_path(input).mime) .to eq "application/postscript" end end describe "#height" do let(:input) { "spec/examples/eps2emf/img.eps" } it "returns height" do expect(described_class.from_path(input).height).to eq 707 end end describe "#width" do let(:input) { "spec/examples/eps2emf/img.eps" } it "returns width" do expect(described_class.from_path(input).width).to eq 649 end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vectory-0.4.2 | spec/vectory/eps_spec.rb |
vectory-0.4.1 | spec/vectory/eps_spec.rb |
vectory-0.4.0 | spec/vectory/eps_spec.rb |