Story Framework

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

On 16 Apr 2008, at 09:04, ?eljko Filipin wrote:

with_steps_for :user do
run ‘rspec’
end

Hi Željko

Did you mean: “run ‘login.txt’” here?

Ashley


http://www.patchspace.co.uk/

Hi Ashley,

Thanks for the response and sorry for the delay, I did not have the time
to
play with rspec these days.

On Wed, Apr 16, 2008 at 10:15 AM, Ashley M. <
[email protected]> wrote:

Did you mean: “run ‘login.txt’” here?

No, I really got it wrong. :slight_smile:

I will take a look at the rest of the documentation today and hopefully
have
something running soon.

Željko

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs