« Return to Thread: Getting Started with Story Runner

Re: Getting Started with Story Runner

by OmenKing :: Rate this Message:

Reply to Author | View in Thread

Some parts of this message have been removed. Learn more about Nabble's security policy.
I'm trying to generate stories based on Dan North's example.
I'm not sure how to do this.

require File.join(File.dirname(__FILE__), "helper")

Story "Account Holder withdraws cash", %{
  As an Account Holder
  I want to withdraw cash from an ATM
  So that I can get money when the bank is closed
}, :type => RailsStory do

Scenario "Account has sufficient funds" do
 
  Given "the account balance is $", 100 do |amount|
    @account = Account.new(:balance => 100)
  end
   And "the card is valid" do
    @account.should_not have.error_on(:balance)
   end
   And "the machine contains enough money" do
    @account.sufficient_funds?
   end
  When "the Account Holder requests $", 20 do |amount|
    @account.withdraw(amount)
  end
  Then "the ATM should dispense $", 20 do |amount|
    post "/account/show", :account => {:amount => amount} #show the receipt
  end
   And "the account balance should be $", 80 do
    @account.balance.should be_eql(80)
   end
   And "the card should be returned" do
    post "account/index"
   end
end
Scenario "Account has insufficient funds" do; end
Scenario "Card has been disabled" do; end
Scenario "The ATM has insufficient funds" do; end

end
Scenario: Account has sufficient funds

  Given the account balance is $ 100
F
Scenario: Account has insufficient funds
.
Scenario: Card has been disabled
.
Scenario: The ATM has insufficient funds
.



4 scenarios: 3 succeeded, 1 failed, 0 pending


FAILURES:
  1) Account Holder withdraws cash (Account has sufficient funds) FAILED
  NameError: uninitialized constant Account
  /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:266:in `load_missing_constant'


When a failure occurs in a story does it always print out a heapstack or is my code incorrect?



On 9/21/07, Evan David Light <evan@...> wrote:
There are also a couple of examples buried in the trunk under examples/story/game-of-life/behaviour/stories

On Sep 20, 2007, at 10:13 AM, Andrew WC Brown wrote:

I'm guessing their isn't a generator for stories yet?

./script/generate story add_person

On 9/20/07, James Hughes <hughes.james@...> wrote:
On 9/20/07, Ben Mabey <ben@...> wrote:

> Andrew WC Brown wrote:
> > I haven't found any How To's to use story runner and I'm not sure how
> > to get started.
> > Should I be looking for resources on how to use rbehave?
> > How do I generate my first Story?
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users@...
> > http://rubyforge.org/mailman/listinfo/rspec-users
> Pat wrote up an awesome tutorial/example:
>
> http://evang.eli.st/blog/2007/9/1/user-stories-with-rspec-s-story-runner
>
> That should get you started.
>

This pastie may be of use as well:

http://pastie.caboo.se/92472

James
_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users
_______________________________________________
rspec-users mailing list


_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users



--
Monsterbox Productions
putting small businesses on-line

1319 Victoria Avenue East
Thunder Bay, Ontario P7C 1C3
Canada

Andrew WC Brown
web-developer and owner
andrew@...
P: 807-626-9009
F: 807-624-2705
_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users

 « Return to Thread: Getting Started with Story Runner