Unable to use Rspec Framework in Watir

Hi ,

My OS is Windows Xp.
I have mentioned a code below.Initially I didn’t had safariwatir
installed.
When i was executing the code, I was getting an Error- No such File
to Load -“safariwatir”
I didn’t Know the Root Cause. So had to install SafariWatir in
Windows.

Now I am able to execute the code.
I am getting “PENDING” which i want to implement
Please tell me how to implement with simple example
and what are the methods i can use.(Please give me the source where
all the methods are listed like “should include”,“should_not
include”,“should have_link”)
Whenever I use these methods"should include" or “should_not include”,
i will get No Method Defined Error. I don’t no which library file
should i “include” or “require”

CODE.

require 'test/unit/assertions'

require ‘rubygems’
require ‘watir’
require ‘spec’
require ‘watir/container’
include Watir::Container
include Test::Unit::Assertions
#include
Spec::Example::Subject::ExampleGroupMethods::ExampleMethods
$email=“www.gmail.com
$username=“USERNAME”
$password=“password”
describe ‘should Navigate to Gmail Login Screen’ do
it ‘Enter username’
$ie = Watir::IE.new
$ie.goto($email)
$ie.text_field(:id, ‘Email’).set($username)
#$ie.text.should (‘Aidy Lewis’)
end

OUTPUT:

C:\Ruby\Abhi_My Ruby>spec abhiRspec.rb --format specdoc

should Navigate to Gmail Login Screen

  • Enter username (PENDING: Not Yet Implemented)

Pending:

should Navigate to Gmail Login Screen Enter username (Not Yet
Implemented)
./abhiRspec.rb:18

Finished in 0.672 seconds

1 example, 0 failures, 1 pending

On Oct 23, 2009, at 2:47 pm, abhisheksreepal wrote:

describe ‘should Navigate to Gmail Login Screen’ do
it ‘Enter username’
$ie = Watir::IE.new
$ie.goto($email)
$ie.text_field(:id, ‘Email’).set($username)
#$ie.text.should (‘Aidy Lewis’)
end

You missed the block delimiters:

describe ‘should Navigate to Gmail Login Screen’ do
it ‘Enter username’ do
$ie = Watir::IE.new
$ie.goto($email)
$ie.text_field(:id, ‘Email’).set($username)
#$ie.text.should (‘Aidy Lewis’)
end
end

Ashley


http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashleymoran

Thanks.

On Oct 24, 8:31 pm, Ashley M. [email protected]

On 26 Oct 2009, at 07:10, abhisheksreepal wrote:

Thanks.

There were a few other things odd about your code though. You don’t
need to use global variables ($), and you’re including thinks into the
global namespace object. RSpec is heavily block-oriented, and it
makes life a lot easier if you understand what it’s doing with them.
For example, you can do this:

Spec::Runner.configure do |config|
config.include(MyModule)
end

If you’re coming to Ruby from another language, it would probably pay
off quickly to study blocks and modules in more detail. It’ll save a
lot of pain later on.

Ashley


http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashleymoran