[Rspec-devel] BDD Question - wheres the BDD help forums?

First Name Last Name kognition at gmail.com
Thu Jul 13 09:08:44 EDT 2006


Hi everybody,

I have a specific question relating to BDD, not RSpec specifically - I have
spent a good hour trying to find a list and cannot find any - please forgive
me.

My question relates to MVP and how to drive it.  I am working on a
Presenter, its context being "A newly created xxxpresenter".  When a method
is invoked on the Presenter from the View, the Model is updated.  "Testing"
that the Presenter picks up the View event (OnCreateAccount), the Presenter
asks the Model to create a default account.  The model raises an event that
the view picks up.  I want to avoid having the Presenter do EVERYTHING, and
I want the Model to be observable as in vanilla MVP.  I have something like
this:

[Test]
public void ShouldAllowNewAccountToBeCreated() {
    int numberOfAccounts = myAccountsModel.Accounts;

    myView.RaiseOnCreateNewAccountEvent();

    Assert.AreEqual(numberOfAccounts + 1, myAccountsModel.Accounts);
}

This code isnt perfect by a long shot, and its the BDD I am more focused
on.  Here the View raises an event which the Presenter subscribed to.  When
the event is picked up in the Presenter, it calls onto the model to ask it
to create a new account.  After this, the number of accounts should have
changed.  What I need to test, and is the reason for my confusion, is at
what point do I deal with the View picking up the OnAccountCreated model
event? My feeling is that I need to be creating a specification for the View
object, and it is there that all the specifications for how the view should
behave are defined. At the same time, I could do the following with the
above test (!):

 [Test]
public void ShouldAllowNewAccountToBeCreated() {
    int numberOfAccounts = myAccountsModel.Accounts;

    myView.RaiseOnCreateNewAccountEvent();

    Assert.AreEqual(numberOfAccounts + 1, myAccountsModel.Accounts);
    Assert.IsNotNil(myView.Account);
}

This leads me to the next question.  If I created a new context,
"OnCreateNewAccount raised", I could then check the model Accounts value,
and check the View.  But this feels like I am slowly but surely sliding off
the plank of BDD theory.

Any help on this, much appreciated!

Karl.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-devel/attachments/20060713/b9302c18/attachment.html 


More information about the Rspec-devel mailing list