Sha256: ed936d91b51acfde71d28e0c743bb667834bdb10d5d83c3c44d58470fa9f1552

Contents?: true

Size: 681 Bytes

Versions: 4

Compression:

Stored size: 681 Bytes

Contents

require "spec_helper"
require "pathname"
require_relative "../../lib/middleman-webp/options"

describe Middleman::WebP::Options do
  describe "#for" do
    it "returns cwebp args when given file matches option file pattern" do
      path = Pathname.new("test_image.jpg")
      options = Middleman::WebP::Options.new("*.jpg" => {lossless: true, q: 85})

      args = options.for(path)
      args.must_match(/^(-q 85|-lossless) (-q 85|-lossless)$/)
    end

    it "returns empty string when no options are defined" do
      path = Pathname.new("test_image.jpg")
      options = Middleman::WebP::Options.new

      args = options.for(path)
      args.must_be_empty
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
middleman-webp-0.2.3 spec/unit/options_spec.rb
middleman-webp-0.2.2 spec/unit/options_spec.rb
middleman-webp-0.2.1 spec/unit/options_spec.rb
middleman-webp-0.2.0 spec/unit/options_spec.rb