title: Rails/Rspec respond_to a method_missing lookup
body: <p>I know some of you are already doubting my sanity with this. I have a <code>ActiveRecord</code> class that uses method missing to dig inside a JSON attribute it has.</p>
  
  <pre><code>  # app/models/request_interactor.rb
  
    ...
  
    def method_missing(method_sym, *arguments, &amp;block)
      return self.request_params[method_sym.to_s] if self.request_params[method_sym.to_s]
      super
    end
  </code></pre>
  
  <p>the test looks like this </p>
  
  <pre><code>before(:each) do
    @ri = RequestInteractor.create(result: {magic_school: true, magic_learnt: 'all things magical'}, request_params: {application_id: 34, school_id: 20, school_name: 'Hogwarts', course_name: 'Defence against the Dark Arts.'})
  end
  
  it 'should respond to attributes set in the request parameters' do
    expect(@ri).to respond_to(:school_name)
    expect(@ri.school_name).to eq('Hogwarts')
  end
  </code></pre>
  
  <p>I tried binding inside the test, the <code>@ri.school_name</code> will eq <code>'Hogwarts'</code>, but when it runs the <code>responds_to</code> it will fail saying there is no such a method! The dirty, dirty liar!</p>
  
  <p>I tried doing something like this in the model:</p>
  
  <pre><code>def respond_to?(method, include_private = false)
    super || self.respond_to?(method, include_private)
  end
  </code></pre>
  
  <p>But this will return a stack level too deep, because of recursion, because of recursion.. so now the fate of my day is in your hands! Enlighten me O' great ones. how would I test the respond to of the method missing. </p>