spec/models/attachy/viewer/file_field_spec.rb in attachy-0.1.2 vs spec/models/attachy/viewer/file_field_spec.rb in attachy-0.2.0

- old
+ new

@@ -1,9 +1,13 @@ +# frozen_string_literal: true + require 'rails_helper' require 'cloudinary' RSpec.describe Attachy::Viewer, '.file_field' do + subject { described_class.new method, object, options, view } + let!(:method) { :avatar } let!(:object) { create :user } let!(:options) { {} } let!(:view) { double } @@ -12,11 +16,9 @@ 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