Question

I've recently run into interesting problem passing parameters to my controller action from my functional test. Previously, I was passing the 'type' parameter (which is required by STI) like that and it worked:

setup do
  get :new, :type => "TimeOfUseTariff"
end

However things have changed and i now need to pass something[type]. I've tried the following but nothing seems to work:

setup do
  get :new, "something[type]" => "TimeOfUseTariff"
end

Neither:

setup do
  get :new, "something[type]".constantize => "TimeOfUseTariff"
end

Is there any way how I can achieve passing this extra parameter?

Was it helpful?

Solution

This should work if the controller expects "something[type]":

setup do
  get :new, :something => {:type => "TimeOfUseTariff"}
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top