Skip to content

Instantly share code, notes, and snippets.

@varyonic
Last active August 29, 2015 14:08
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Deprecated but working version of form_buffers removed by https://github.com/activeadmin/activeadmin/pull/3486
module ActiveAdmin
module Views
class ActiveAdminForm
class DeprecatedFormBufferSubstitute
def initialize(form)
@form = form
end
def << (value)
@form.text_node value.html_safe
end
end
def form_buffers
warn "DEPRECATION WARNING: 'form_buffers' is no longer needed."
@form_buffers ||= [DeprecatedFormBufferSubstitute.new(self)]
end
end
end
end
context "with deprecated form_buffers workaround" do
let :body do
build_form do |f|
f.inputs
f.form_buffers.last << '<span>appended to last form buffer</span>'
f.actions
end
end
it "should allow injection of html" do
expect(body).to have_tag 'span', 'appended to last form buffer'
expect(body.index('form buffer')).to be > body.index('label')
expect(body.index('form buffer')).to be < body.index('Cancel')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment