Sha256: 53ac5b87c28432a41db732108e21602428a255555605653283cf1da6f2eece5d

Contents?: true

Size: 579 Bytes

Versions: 3

Compression:

Stored size: 579 Bytes

Contents

require 'rails_helper'

class DummyHelper
  include Attachy::ViewHelper
end

RSpec.describe DummyHelper, '.attachy_file_field' do
  let!(:method)  { :avatar }
  let!(:options) { { key: :value } }
  let!(:object)  { create :user }
  let!(:helper)  { DummyHelper.new }
  let!(:viewer)  { double Attachy::Viewer, file_field: :file_field }

  before do
    allow(Attachy::Viewer).to receive(:new).with(method, object, options, helper) { viewer }
  end

  it 'calls file_field from viewer' do
    expect(helper.attachy_file_field(method, object, options)).to eq :file_field
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
attachy-0.1.2 spec/helpers/attachy/attachy_file_field_spec.rb
attachy-0.1.1 spec/helpers/attachy/attachy_file_field_spec.rb
attachy-0.1.0 spec/helpers/attachy/attachy_file_field_spec.rb