On Wed, Feb 24, 2010 at 11:12 AM, Adam Reed <reed.a...@gmail.com> wrote:
> Thanks Željko!
>
> 1.  I used the require 'spec' so that I could execute the script in
> SciTE to check for simple errors before running spec from the command
> line.  To your point, I will make sure not to include it on future
> scripts.
>
> 2.  Agree with you on the before(:all)/(:each) - I'm still figuring
> out how that works practically in my tests.
>
>> What is this?
>>
>> @browser ||= Watir::Browser.new
>
> 3.  I actually took that from the RSpec example here:
> http://wiki.openqa.org/display/WTR/RSpec
> I hate to admit that I implemented it without knowing exactly what it
> did, but in testing it did not seem to change behavior.  I have not
> used it with any other scripts but this first venture into RSpec.
>

This ruby construct
object ||= otherobject

is equivalent to
object = object || otherobject

and similar to
i += 1
meaning
i = i + 1

in watir example:
@browser ||= Watir::Browser.new
means
@browser = @browser  || Watir::Browser.new

a narrative could be: let the @browser be @browser if true
else start new browser and initialize @browser value from constructor.
HTH


marekj

Watirloo: Semantic Page Objects in UseCases
http://github.com/marekj/watirloo/
Support Watir Project http://pledgie.com/campaigns/2982

-- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general

Reply via email to