Colfer, Brian wrote:> I am writing a feature that will test an LDAP protected site. I need to > login as my self with my real password.When unit testing, thou shalt not hit the wire. Mock anything that goes further than your database. Put another way, you are not going to refactor LDAP itself, or add features to it, so mocks should set the boundaries to what you do expect to refactor.
Colfer, Brian
2009-Apr-15 06:46 UTC
[rspec-users] How to write a feature that calls for a prompt?
Phlip, Ah, but I am not unit testing ... I am writing an acceptance test. I am QA, not the developer and using cucumber to automate the functional and acceptance tests. Brian -----Original Message----- From: rspec-users-bounces at rubyforge.org [mailto:rspec-users-bounces at rubyforge.org] On Behalf Of Phlip Sent: Tuesday, April 14, 2009 8:22 PM To: rspec-users at rubyforge.org Subject: Re: [rspec-users] How to write a feature that calls for a prompt? Colfer, Brian wrote:> I am writing a feature that will test an LDAP protected site. I need > to login as my self with my real password.When unit testing, thou shalt not hit the wire. Mock anything that goes further than your database. Put another way, you are not going to refactor LDAP itself, or add features to it, so mocks should set the boundaries to what you do expect to refactor. _______________________________________________ rspec-users mailing list rspec-users at rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Pat Maddox
2009-Apr-15 15:56 UTC
[rspec-users] How to write a feature that calls for a prompt?
You can use IO.popen to run and interact with a command line program. Pat On Tue, Apr 14, 2009 at 1:58 PM, Colfer, Brian <bcolfer at shopping.com> wrote:> 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 at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >