Sha256: e12ebf147aec9e4f9f78d85008762b413a25d5ea79ef7e02c3dfaa03f565cbc5

Contents?: true

Size: 607 Bytes

Versions: 4

Compression:

Stored size: 607 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Attachy::Viewer, '.hidden_field' do
  subject { described_class.new method, object }

  let!(:object) { create :user }
  let!(:method) { :avatar }

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

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

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

  it 'returns the hidden field with attachments value' do
    el = subject.hidden_field

    expect(el).to have_tag :input, with: { name: 'user[avatar]', type: 'hidden', value: 'value' }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
attachy-0.4.1 spec/models/attachy/viewer/hidden_field_spec.rb
attachy-0.4.0 spec/models/attachy/viewer/hidden_field_spec.rb
attachy-0.3.0 spec/models/attachy/viewer/hidden_field_spec.rb
attachy-0.2.0 spec/models/attachy/viewer/hidden_field_spec.rb