require "rails_helper"

RSpec.describe ImagesHelper do
  describe "#thumbnail_variant" do
    it "calls variant with orient and size options" do
      attachment = double(:attachment)
      allow(attachment).to receive(:variant)

      helper.thumbnail_variant(attachment)

      expect(attachment).to have_received(:variant).with(
        gravity: "center",
        resize: "75x75>",
        extent: "75x75",
        background: "#fff",
      )
    end
  end

  describe "#medium_variant" do
    it "calls variant with orient and size options" do
      attachment = double(:attachment)
      allow(attachment).to receive(:variant)

      helper.medium_variant(attachment)

      expect(attachment).to have_received(:variant).with(
        gravity: "center",
        resize: "100x100>",
        extent: "100x100",
        background: "#fff",
      )
    end
  end

  describe "#large_variant" do
    it "calls variant with orient and size options" do
      attachment = double(:attachment)
      allow(attachment).to receive(:variant)

      helper.large_variant(attachment)

      expect(attachment).to have_received(:variant).with(
        gravity: "center",
        resize: "150x150>",
        extent: "150x150",
        background: "#fff",
      )
    end
  end
end
