[rspec-users] Passing parameters to Rspec scripts

Levi Conley zenshade at gmail.com
Thu Feb 4 12:35:33 EST 2010

Thanks for the response. That's an interesting approach.  I will try
that and see how far I can get with it.

If my ruby chops were a little better, I suspect I could find a more
elegant solution.  Any other ideas out there?

On 2/3/10, Matt Wynne <matt at mattwynne.net> wrote:
> One way would be to use an environment variable:
>      $ CUSTOMER=foo spec spec
> Then read out the customer name in your specs:
>      login = ENV['CUSTOMER']
> Otherwise, I would guess you might be able to look at ARGV from
> within, say, spec_helper.rb but I've never tried it.
> On 3 Feb 2010, at 03:51, Levi Conley wrote:
>> Newbie here.  I'm hoping someone can give me an outline of how to
>> re-use rspec scripts by passing them parameters.
>> The situation I have is testing a web application (using watir) for
>> about 30 different customers.  Some of the customers have unique
>> features in their particular application instance, but much of the
>> codebase is shared (about 90%).  So what I need to be able to do is
>> write rspec tests covering that shared codebase.  But I need to in
>> some way pass in the customer name so that watir can log into the
>> right application instance.
>> Any help with this is greatly appreciated.  I still have much to learn
>> about Rspec, but so far this seemingly simple task has me stumped.
>> Thanks
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
> cheers,
> Matt
> http://mattwynne.net
> +447974 430184
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

My mother used to say to me, "In this world, Elwood, you must be oh so
smart or oh so pleasant."  Well, for years I was smart.  I recommend
pleasant.  You may quote me.

More information about the rspec-users mailing list