[rspec-users] Story Framework

Željko Filipin zeljko.filipin at gmail.com
Wed Apr 16 04:04:49 EDT 2008


I want to use story framework for driving my (functional) Watir tests. I
want to start with something simple, like logging in. I had an hour today to
try it, and I did not get very far. (I have found
http://rspec.info/documentation/stories.html and I will take a look at it
tomorrow.)

I have found basic information about story framework at rspec.info and
modified example from there. Am I on the right track?

login.txt:

Story: login user
  As registered user
  I want to log in
  So I can use the application

  Scenario: user name and password are correct
    Given my user name and password are correct
    When I enter user name and password at login page and click login button
    I should be logged in



define.rb:

steps_for(:user) do
  Given("my $username and $password are correct") do |username, password|
    member = User.new(username, password)
  end
  When("I enter $username and $password at login page and click login
button") do |member|
    member.log_in
  end
  Then("I should be logged in") do |member|
    member.should be_logged_in
  end
end



run.rb:

with_steps_for :user do
  run 'rspec'
end



Željko Filipin
-- 
ZeljkoFilipin.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080416/1d99a267/attachment.html 


More information about the rspec-users mailing list