title: How to handle Rails 'render' method in RubyGem test case?
body: <p>I'm currently working on a gem that adds some functionality to ActionView dynamically:</p>
  
  <pre><code>ActiveSupport.on_load(:action_view) do
    include CustomFormBuilder::FormHelper
  end
  </code></pre>
  
  <p>This form builder has a <code>custom_form_for</code> method that calls <code>render</code> in order to render a partial. </p>
  
  <p>In practice, this works great.</p>
  
  <p>However, I am attempting to add some rspec test cases to test the gem, and I keep getting:</p>
  
  <pre><code>undefined method 'render' for #&lt;RSpec::ExampleGroup::CustomFormBuilderFormHelper::CustomFormFor
  </code></pre>
  
  <p>I assume it's because my <code>on_load</code> callback is never being hit, though I have tried to programaticaly call <code>ActiveSupport.run_load_hooks(:action_view)</code>, which also didn't work.</p>
  
  <p>Full spec code:</p>
  
  <pre><code>require 'spec_helper'
  
  describe CustomFormBuilder::CustomFormHelper do
      describe 'custom_form_for' do 
          before do 
              @new_record = CustomFormBuilderSpecHelper::Record.new
          end
  
          it "should create custom submit button" do
              custom_form_for(@new_record) do |builder|
                  builder.submit('Submit').should eq 'fail'
              end
          end
      end
  end
  </code></pre>
  
  <p>And spec_helper:</p>
  
  <pre><code>require 'action_view'
  require 'active_model'
  require 'custom_form_builder'
  
  include CustomFormBuilder::CustomFormHelper
  
  module CustomFormBuilderSpecHelper
      class Record
          include ActiveModel::Validations
          validates :name, presence: true, inclusion: {in: %w(Name1 Name2 Name3)}
  
      end 
  end
  </code></pre>