I am testing rake task when arguments are passed, I am trying to run a rake task like this
rake do_something_after_n_number_of_days 30
when I run
let(:task) { Rake::Task['do_something_after_n_number_of_days'] }
task.invoke(30)
I get ARGV[1] as nil but when I run the rake task in the shell it works fine.
I have looked in to these answers 1 2 but all of them describe this approach
rake do_something_after_n_number_of_days[30]
and I can test that with test.invoke(30) but in some shells I have to escape the brackets like this
rake do_something_after_n_number_of_days\[30\]