Sha256: b8607086dcccc908182c7bb70d1cb73a5a4e50be897e037a8cd04ecaa96c4ed9

Contents?: true

Size: 671 Bytes

Versions: 1

Compression:

Stored size: 671 Bytes

Contents

require 'spec_helper'

describe Spotlight::FeaturedImage do
  context "with an uploaded resource" do
    subject { described_class.new }
    let(:document) { double(uploaded_resource?: true) }

    it "should replace the remote_image_url fragment with the local path to the file" do
      allow(document).to receive_message_chain(:uploaded_resource, :url, file: File.open(File.join(FIXTURES_PATH, "avatar.png")))
      allow(subject).to receive(:document).and_return(document)

      subject.remote_image_url = "/some/path"
      expect(subject.remote_image_url).to be_nil

      subject.validate

      expect(subject.image.filename).to eq 'avatar.png'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-spotlight-0.4.1 spec/models/spotlight/featured_image_spec.rb