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
On 16 Apr 2008, at 09:04, ?eljko Filipin wrote:> with_steps_for :user do > run ''rspec'' > endHi ?eljko Did you mean: "run ''login.txt''" here? Ashley -- http://www.patchspace.co.uk/ http://aviewfromafar.net/
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 Moran < ashley.moran at patchspace.co.uk> wrote:> Did you mean: "run ''login.txt''" here?No, I really got it wrong. :) I will take a look at the rest of the documentation today and hopefully have something running soon. ?eljko -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080418/1ae82c35/attachment.html