mercredi 23 septembre 2015

In Rails Controller testing, is there a way to pass action parameter?

I'm writing controller tests in Rails, and I need pass action parameters to the controller. This is my test:

 module Payments
  class YandexControllerTest < ActionController::TestCase
    test "notify sucess" do
      post :notify, { action: 'paymentAviso', 'some_other_param': 'value' }
      assert_response :success
      puts response.body
    end
  end
end

This is my controller:

class Payments::YandexController < ApplicationController
  def notify
    render text: request.raw_post
  end
end

And when I run test I see:

Running:

some_other_param=value

Is there a way to pass action parameter to my controller?

Aucun commentaire:

Enregistrer un commentaire