Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4622

How do I stub method_options using Rspec?

$
0
0
Class CLI < Thor  desc "run [age]" "user passes age"  method_option :age,type:'numeric'  def run    variable=options[:a] if options[:a].present?    call_method(a)  endend

How do I mock options[:a] using Rspec if I want to test the following line?

variable=options[:a] if options[:a].present?

Also, how do I test whether the local variable is updated or not?


Viewing all articles
Browse latest Browse all 4622


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>