title: How to stub the Params values when i am testing a controller by Rspec
body: <p>Can anyone please let me know if it is possible to stub params[] values in controller spec, so that the controller accepts the stubbed values as actual params[] value from view.</p>
  
  <p>for example,
  my view has a statement as</p>
  
  <pre><code>&lt;%= form_tag("/expense_details/add_expense", :method=&gt;"post") do %&gt;
  &lt;%= text_field_tag(:eamt, nil, placeholder: "Expense Amount") %&gt;
  </code></pre>
  
  <p>my controller has a statement as</p>
  
  <pre><code>expense_type= params[ :eamt ]
  if !expense_type.nil?
  session[:emsg]="filled"
  else
  session[:emsg]="empty"
  end
  </code></pre>
  
  <p>my controller spec is as follows</p>
  
  <pre><code>it "successful save" do
  my spec has condition as
  post 'add_expense' 
  session[:emsg].should == "filled"
  end
  </code></pre>
  
  <p>But my test is faling everytime with this below status</p>
  
  <pre><code> Failure/Error: session[:emsg].should == "filled"
     expected: "filled"
          got: "empty" (using ==)
  </code></pre>
  
  <p>can anyone please let me know how can i achieve this?
  Thanks in advance</p>