[rspec-users] Such a simple test fails. But why ?

Katrina Owen katrina.owen at gmail.com
Wed Feb 15 14:59:30 EST 2012

On Wed, Feb 15, 2012 at 5:57 PM, Serguei Cambour <lists at ruby-forum.com> wrote:

> WHY the second argument is NIL if it WAS NOT before
> (path/to/some/folder)?

If you change this:
> options.export_folder.should == argv[1]

to this:
options.export_folder.should eq(argv[1])

You will see that you get the value that you've set in DEFAULT_EXPORT_FOLDER.

That's not quite the desired behavior either, though.

I think the issue is with the OptionParser... you define all the
options, but I can't see that you ever actually tell it to parse.

> option_parser = OptionParser.new do |opts|
>   # lots of definitions
> end

If I'm reading this correctly, the missing piece of code is this:

Note that you don't want to use the bang version, because that will
change your argv array, and when you compare it in the spec, argv[1]
will be nil.


More information about the rspec-users mailing list