I have an action called yearly_csv
. In this action I perform two operations like demand and supply.
def yearly_csv
if demand == 'true'
demand_csv
else
supply_csv
end
end
I have two radio buttons in my view to select one of the operations. Now I want to test each operation individually in RSpec. For example, one spec for supply and another spec for demand.
My question is how to pass the radio button value to the yearly_csv
action (get)?
In newer versions for RSpec, you must declare query string params using the params
key:
get :yearly_csv, params: { demand: 'true' }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With