Sha256: d720d224d19f475aaec24ae3c56930fc845ac751ba3361f90ef7ba86f4606627

Contents?: true

Size: 753 Bytes

Versions: 3

Compression:

Stored size: 753 Bytes

Contents

require 'rails_helper'
require 'cloudinary'

RSpec.describe Attachy::Viewer, '.file_field' do
  let!(:method)  { :avatar }
  let!(:object)  { create :user }
  let!(:options) { {} }
  let!(:view)    { double }

  let!(:file) do
    allow(Cloudinary::Uploader).to receive(:remove_tag)

    create :file, attachable: object, scope: method
  end

  before { allow(subject).to receive(:file_field_options) { { key: :value } } }

  subject { described_class.new method, object, options, view }

  it 'returns the hidden field with attachments value' do
    allow(view).to receive(:cl_image_upload_tag).with(method, html: subject.file_field_options, tags: [Attachy::ENV_TAG, Attachy::TMP_TAG]) { :input }

    expect(subject.file_field).to eq :input
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
attachy-0.1.2 spec/models/attachy/viewer/file_field_spec.rb
attachy-0.1.1 spec/models/attachy/viewer/file_field_spec.rb
attachy-0.1.0 spec/models/attachy/viewer/file_field_spec.rb