[rspec-users] Parsing Variables from the RakeFile to spec_helper

David Chelimsky dchelimsky at gmail.com
Thu Nov 6 08:39:21 EST 2008


On Thu, Nov 6, 2008 at 4:52 AM, Togetherne Togetherne
<lists at ruby-forum.com> wrote:
> Is this possible, i basically want to create a loop in my Rakefile which
> updates a variable in my spec file with every run the variable is
> something like:
>
>  browser =  ENV['SELENIUM_RC_BROWSER'] || "*chrome"
>
> in my spec_helper i have:
>
>
>  def create_selenium_driver
>    remote_control_server = ENV['SELENIUM_RC_HOST'] || "localhost"
>    port = ENV['SELENIUM_RC_PORT'] || 4444
>    browser = ENV['SELENIUM_RC_BROWSER']
>    #browser = ENV['SELENIUM_RC_BROWSER'] || "*chrome"
>    timeout = ENV['SELENIUM_RC_TIMEOUT'] || 200
>    application_host = ENV['SELENIUM_APPLICATION_HOST'] || ""
>    #application_port = ENV['SELENIUM_APPLICATION_PORT'] || ""
>
>        @selenium_driver = Selenium::Client::Driver.new(
>        remote_control_server, port, browser,
>        "http://#{application_host}", timeout)
>
>  end
>
> I basically want to change the browser variable in my RakeFile and parse
> it to my spechelper so i can change it with every run.....any ideas?

Are you saying you want to type the same command and have it behave
differently each time? I think you'd have to save something to a file
each run and read it in each subsequent run.

Why not create different tasks? There's a few ways you can handle that
and keep control from the command line.


More information about the rspec-users mailing list