title: ERB template binding not cascading to helper
body: <p>I have the following code:</p>
  <pre><code>user = &quot;GG&quot;
  erb = ERB.new &quot;Hi &lt;%= user %&gt;!&quot;
      
  puts erb.result(binding)
  </code></pre>
  <p>resulting in the correct <code>Hi GG!</code></p>
  <p>If I create a helper:</p>
  <pre><code>module Helper
    def hello
      &quot;hello&quot;
    end
  end
  
  include Helper
  
  erb = ERB.new &quot;Hi &lt;%= hello %&gt;!&quot;
      
  puts erb.result(binding)
  </code></pre>
  <p>still works and puts: <code>Hi hello!</code></p>
  <p>but if I use a variable from the context in the helper I get problems:</p>
  <pre><code>module Helper
    def hello
      &quot;hello #{user}&quot;
    end
  end
  
  include Helper
  
  user = &quot;GG&quot;
  erb = ERB.new &quot;Hi &lt;%= hello %&gt;!&quot;
      
  puts erb.result(binding)
  </code></pre>
  <p>I get:</p>
  <pre><code>NameError: undefined local variable or method `user' for main:Object
  </code></pre>
  <p>why is this happening? how could I solve it?</p>
  <p>Thanks.</p>
  <p><strong>update</strong>
  I tried setting the variable as an instance variable:</p>
  <pre><code>module Helper
    def hello
      &quot;hello #{@user}&quot;
    end
  end
  
  include Helper
  
  @user = &quot;GG&quot;
  erb = ERB.new &quot;Hi &lt;%= hello %&gt;!&quot;
      
  puts erb.result(binding)
  </code></pre>
  <p>this seems to work, I'm not sure what's the difference though.</p>
  <p>also I need this to work as I'm working on the rspec test, in the rails service (in the app), the same code is working great.</p>