Sha256: a8db22ed914241064200c01fd67c43c5ba743048eba59ae1dc8ab898f4d73557
Contents?: true
Size: 1015 Bytes
Versions: 3
Compression:
Stored size: 1015 Bytes
Contents
require "refile/rails/attachment_helper" require "refile/active_record_helper" require "refile/attachment/active_record" require "action_view" describe Refile::AttachmentHelper do include Refile::AttachmentHelper include ActionView::Helpers::AssetTagHelper let(:klass) do Class.new(ActiveRecord::Base) do self.table_name = :posts def self.name "Post" end attachment :document end end let(:attachment_path) { "/attachments/00cc2633d08c6045485f1fae2cd6d4de20a5a159/store/xxx/document" } before do allow(Refile).to receive(:secret_key).and_return("xxxxxxxxxxx") end describe "#attachment_image_tag" do let(:src) { attachment_image_tag(klass.new(document_id: "xxx"), :document)[/src="(\S+)"/, 1] } it "builds with path" do allow(Refile).to receive(:app_host).and_return(nil) expect(src).to eq attachment_path end it "builds with host" do expect(src).to eq "http://localhost:56120#{attachment_path}" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
refile-0.6.2 | spec/refile/attachment_helper_spec.rb |
refile-0.6.1 | spec/refile/attachment_helper_spec.rb |
refile-0.6.0 | spec/refile/attachment_helper_spec.rb |