I am writing a feature that will test an LDAP protected site.  I need to
login as my self with my real password.

I'm thinking of writing a feature that looks something like this

Feature: Login
        As a LDAP user 
        I want to login 
        And see the welcome banner
        So that I can know that I can login to the system

        Scenario: LDAP login
                Given a LDAP user
                When I go to the site "https://toolsite.domain.com";
                And I enter the login name "enter_login_name"
                And I enter the password "enter_password"
                Then I should see the welcome banner "Tool Site at
Domain.com"

I imagine that I can have a step that would look something like this?

require 'highline/import'
require 'my-user-def'
require 'my-site-runner'

Given /^a LDAP user$/ do
  @user.new
end

When /^I go to the site "([^\"]*)"$/ do |arg1|
  @site.goto(arg1)
end

When /^I enter the login name "([^\"]*)"$/ do |arg1|
  if arg1 == "enter_login_name"
      @user.login_name = ask("Enter login name") {|q| q.echo = true}
  end
end

When /^I enter the password "([^\"]*)"$/ do |arg1|
  if arg1 == "enter_password"
      @user.password = ask("Enter password") {|q| q.echo = false}
  end
end

Then /^I should see the welcome banner "([^\"]*)"$/ do |arg1|
  @site.text.include? arg1 == true
end     
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to