title: framework integration testing within a gem: how to set up rspec controller test for a gem rails integration
body: <p>This question is NOT about how to test controllers in a rails app.</p>
  
  <p>Developing a gem I want to test if my gem integrates in a rails controller.
  So running rspec in the gem root is outside the rails environment.</p>
  
  <p>Now how do I write say a controller test which can use the rspec controller example group helpers like <code>get</code> or <code>post</code>?</p>
  
  <p>IN particular if I set a metatag <code>:type =&gt; :controller</code> on an example group , how does rspec set up the rails environment and how can i hook into that in order to say set up routes, etc.</p>
  
  <p>I'd rather not have to set up an entire rails app skeleton mostly empty. But I cannot even find info on how to do that. What is best practice to test a gem integrating to rails app or multiple frameworks.</p>
  
  <p>These sources came closest to what I am after:
  <a href="https://stackoverflow.com/questions/2577372/test-with-rspec-a-controller-outside-of-a-rails-environment">Test (with RSpec) a controller outside of a Rails environment</a>
  but this is for test unit.
  <a href="http://railsware.com/blog/2012/01/07/testing-gem-integration-with-multiple-ruby-frameworks/" rel="nofollow noreferrer">http://railsware.com/blog/2012/01/07/testing-gem-integration-with-multiple-ruby-frameworks/</a>
  but this is for capybara which directly hooks in a rails app class.</p>
  
  <p>thanks all</p>