[Wtr-general] Fetching Today's date in the mm/dd/yyyy

2007-05-30 Thread sapna
Hi,

Can you tell me how to fetch today's date and decrement month or day or year. 
This is basically to test the functionality of date which must be today or in 
the past.


Regards
Sapna
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Fetching Today's date in the mm/dd/yyyy

2007-05-30 Thread Angrez Singh

Hi,

You can refer to following link for more details on how to format date.
http://www.ruby.ch/ProgrammingRuby/htmlC/ref_c_time.html#strftime

- Angrez

On 5/30/07, sapna [EMAIL PROTECTED] wrote:


Hi,

Can you tell me how to fetch today's date and decrement month or day or
year. This is basically to test the functionality of date which must be
today or in the past.


Regards
Sapna
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Fetching Today's date in the mm/dd/yyyy

2007-05-30 Thread Ċ½eljko Filipin

Hi Sapna,

This is how to get date formated like you need.

Time.now.strftime(%m/%d/%Y)
= 05/30/2007

You can get yesterdays date by subtracting seconds from current time.

t = Time.now-(60*60*24)
= Tue May 29 12:21:02 Central European Standard Time 2007

t.strftime(%m/%d/%Y)
= 05/29/2007

Zeljko
--
ZeljkoFilipin.com
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] instantiate a class that inherits from Test::Unit

2007-05-30 Thread aidy lewis
#Hi
#Is it possible to instantiate a class that inherits from Test::Unit

require 'test\unit'
class Login  Test::Unit::TestCase

  def username;$ie.text_field(:name, 'username');end
  def password;$ie.text_field(:name, 'password');end
  def sign_in;$ie.button(:alt, /Log in/);end

  def check_main_screen_objects
assert(self.username.exists?)
assert(self.password.exists?)
assert(self.sign_in.exists?)
  end

end

login = Login.new
login.check_main_screen_objects


#if not how can I get round this?

#Aidy
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] 'Require' Lots Of Files

2007-05-30 Thread Fletch
Hello Again All,

I have created a couple of large test suites, which use LOTS of requires

require 'dir/test1'
require 'dir/test2'
...
require 'dir/test25'

In an effort to create tidier looking code, is it possible to use something 
like Java would have to import, or 'require' all the files in one line.

import dir.*

Thanks,

Fletch.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] 'Require' Lots Of Files

2007-05-30 Thread Paul Rogers

I use this method:

def require_files_in_dir( start_dir )

files = Dir[ start_dir]
files.each do |f|
require f
end

end





- Original Message -
From: Fletch [EMAIL PROTECTED]
Date: Wednesday, May 30, 2007 9:16 am
Subject: [Wtr-general] 'Require' Lots Of Files

 Hello Again All,
 
 I have created a couple of large test suites, which use LOTS of 
 requires
 require 'dir/test1'
 require 'dir/test2'
 ...
 require 'dir/test25'
 
 In an effort to create tidier looking code, is it possible to use 
 something like Java would have to import, or 'require' all the 
 files in one line.
 
 import dir.*
 
 Thanks,
 
 Fletch.
 ___
 Wtr-general mailing list
 Wtr-general@rubyforge.org
 http://rubyforge.org/mailman/listinfo/wtr-general
 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] 'Require' Lots Of Files

2007-05-30 Thread Fletch
Thanks for the reply - not to sound silly at all, but where do I put this 
method?

All the require files normally go at the top of the file, but I have tried 
putting the code everywhere I can think of and still have had no luck.

--

require 

className
  def test1
  end
  def test2
  end
end

--

Ideally it will replace the require, but I can not obviously put a method up 
there (can I?).

Thanks,

Fletch.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] 'Require' Lots Of Files

2007-05-30 Thread Paul Rogers

def require_files_in_dir

end

require_files_in_dir( 'c:\')
require_files_in_dir( 'c:\temp')



- Original Message -
From: Fletch [EMAIL PROTECTED]
Date: Wednesday, May 30, 2007 9:39 am
Subject: Re: [Wtr-general] 'Require' Lots Of Files

 Thanks for the reply - not to sound silly at all, but where do I 
 put this method?
 
 All the require files normally go at the top of the file, but I 
 have tried putting the code everywhere I can think of and still 
 have had no luck.
 
 --
 
 require 
 
 className
  def test1
  end
  def test2
  end
 end
 
 --
 
 Ideally it will replace the require, but I can not obviously put a 
 method up there (can I?).
 
 Thanks,
 
 Fletch.
 ___
 Wtr-general mailing list
 Wtr-general@rubyforge.org
 http://rubyforge.org/mailman/listinfo/wtr-general
 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] 'Require' Lots Of Files

2007-05-30 Thread Paul Rogers
just saw your other question..

doing 
def some_method
end

def some_other_method
end

class Foo
end

class Foo2
end

makes the some_method and some_other_method accessable to all - what ruby does 
is adds them to class Object, which is the super class of everything - you can 
see this by doing the following in irb

def x ; puts 'x'; end
Object.instance_methods

Paul

- Original Message -
From: Fletch [EMAIL PROTECTED]
Date: Wednesday, May 30, 2007 9:39 am
Subject: Re: [Wtr-general] 'Require' Lots Of Files

 Thanks for the reply - not to sound silly at all, but where do I 
 put this method?
 
 All the require files normally go at the top of the file, but I 
 have tried putting the code everywhere I can think of and still 
 have had no luck.
 
 --
 
 require 
 
 className
  def test1
  end
  def test2
  end
 end
 
 --
 
 Ideally it will replace the require, but I can not obviously put a 
 method up there (can I?).
 
 Thanks,
 
 Fletch.
 ___
 Wtr-general mailing list
 Wtr-general@rubyforge.org
 http://rubyforge.org/mailman/listinfo/wtr-general
 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] 'Require' Lots Of Files

2007-05-30 Thread Paul Rogers

actually it seems you have to use it like this
require_files_in_dir( 'c:\*.rb')

- Original Message -
From: Paul Rogers [EMAIL PROTECTED]
Date: Wednesday, May 30, 2007 9:43 am
Subject: Re: [Wtr-general] 'Require' Lots Of Files

 
 def require_files_in_dir
 
 end
 
 require_files_in_dir( 'c:\')
 require_files_in_dir( 'c:\temp')
 
 
 
 - Original Message -
 From: Fletch [EMAIL PROTECTED]
 Date: Wednesday, May 30, 2007 9:39 am
 Subject: Re: [Wtr-general] 'Require' Lots Of Files
 
  Thanks for the reply - not to sound silly at all, but where do I 
  put this method?
  
  All the require files normally go at the top of the file, but I 
  have tried putting the code everywhere I can think of and still 
  have had no luck.
  
  --
  
  require 
  
  className
   def test1
   end
   def test2
   end
  end
  
  --
  
  Ideally it will replace the require, but I can not obviously put 
 a 
  method up there (can I?).
  
  Thanks,
  
  Fletch.
  ___
  Wtr-general mailing list
  Wtr-general@rubyforge.org
  http://rubyforge.org/mailman/listinfo/wtr-general
  
 ___
 Wtr-general mailing list
 Wtr-general@rubyforge.org
 http://rubyforge.org/mailman/listinfo/wtr-general
 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] 'Require' Lots Of Files

2007-05-30 Thread Fletch
Thanks,

I still can not get it sorted.

My methods are set up in a (java style) static context - FILENAME.methodName, 
and when I use the method for the requires, I am getting an uninitialized 
constant error message.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] 'Require' Lots Of Files

2007-05-30 Thread Bach Le
What I do is if I have to require a certain set of files repeatedly, I just 
place it in another .rb file and require that .rb file which will in turn 
require all of the files you need.

So I would define a file called requirements.rb

and then inside that file place

require 'x'
require 'y'
require 'z'


and in the ruby script i'm running, put require 'requirements.rb' or something 
that way you don't require files you don't need
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Count checked checkbox

2007-05-30 Thread Mark
an alternative could be:

irb ie.form(:index, 1).checkboxes.find_all{|checkbox| checkbox.checked?}
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] instantiate a class that inherits from Test::Unit

2007-05-30 Thread Charley Baker

Hi Aidy,

 You can mix in the assertions if that's all you're looking for:


On 5/30/07, aidy lewis [EMAIL PROTECTED] wrote:


#Hi
#Is it possible to instantiate a class that inherits from Test::Unit

require 'test\unit\assertions'
class Login  # Test::Unit::TestCase




include Test::Unit::Assertions



  def username;$ie.text_field(:name, 'username');end
  def password;$ie.text_field(:name, 'password');end
  def sign_in;$ie.button(:alt, /Log in/);end

  def check_main_screen_objects
assert(self.username.exists?)
assert(self.password.exists?)
assert(self.sign_in.exists?)
  end

end

login = Login.new
login.check_main_screen_objects


#if not how can I get round this?

#Aidy
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] 'Require' Lots Of Files

2007-05-30 Thread Clayton John Givens
Why not put all those files into a gem? 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bach Le
Sent: Wednesday, May 30, 2007 10:30 AM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] 'Require' Lots Of Files

What I do is if I have to require a certain set of files repeatedly, I
just place it in another .rb file and require that .rb file which will
in turn require all of the files you need.

So I would define a file called requirements.rb

and then inside that file place

require 'x'
require 'y'
require 'z'


and in the ruby script i'm running, put require 'requirements.rb' or
something that way you don't require files you don't need
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] How click on save button in file download

2007-05-30 Thread Fanny
Hi,

I'm having the same problem and I was wondering if anybody had found a solution.
My program works well until I click on the download button, and then the popup 
window for saving shows up. It keeps running but doesn't click on the save 
button. I tried the previous code, but it doesn't work... 

ie.button(:value, Download File).click

autoit = WIN32OLE.new(AutoItX3.Control)
autoit.WinWait(File Download, , 5)
autoit.ControlClick(File Download, , Save)
autoit.WinWait(Save As, Save in, 5)
autoit.ControlSetText(Save As, Save in, Edit1, path\filename.ext)
autoit.ControlClick(Save As, Save in, Save)


Is there something to download to be able to use it in watir?
Can I just include this in my other coding, or do I need to run it aside?

Satine
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] 'Require' Lots Of Files

2007-05-30 Thread Bret Pettichord
Fletch wrote:
 I have created a couple of large test suites, which use LOTS of requires

 require 'dir/test1'
 require 'dir/test2'
 ...
 require 'dir/test25'

 In an effort to create tidier looking code, is it possible to use something 
 like Java would have to import, or 'require' all the files in one line.

 import dir.*
   
Replace your require's with this:

Dir['dir/*.rb'].each{|x| require x}
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] instantiate a class that inherits from Test::Unit

2007-05-30 Thread Bret Pettichord
aidy lewis wrote:
 #Is it possible to instantiate a class that inherits from Test::Unit
   
Yes it is. Why do you ask? Did you try this and run into trouble? What 
kind of trouble?
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Microsoft Support for Ruby

2007-05-30 Thread Bret Pettichord
Some of you may have seen some of the recent announcements from 
Microsoft regarding their plans to support Ruby in the .Net environment. 
This is an excellent post that analyzes the impact that this may have: 
http://martinfowler.com/bliki/RubyMicrosoft.html

Bret
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Not able to find the title of newly opened window.

2007-05-30 Thread kumari
Hi
when i click on a table.the table opens a new window with a title which was not 
there in table.so i am facing a problem to identify the new window title.How 
can i get the TITLE of window ? as i may not click on same table all the time.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general