Last active
August 29, 2015 14:08
-
-
Save varyonic/542c37648de91a02402a to your computer and use it in GitHub Desktop.
Deprecated but working version of form_buffers removed by https://github.com/activeadmin/activeadmin/pull/3486
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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