[rspec-users] Passing parameters to Rspec scripts
Matt Wynne
matt at mattwynne.net
Wed Feb 3 03:37:06 EST 2010
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
More information about the rspec-users
mailing list