[rspec-users] BDDish rspecish question

Dan North tastapod at gmail.com
Fri Aug 29 15:54:30 EDT 2008


This is one of the tiny-but-amazing details that makes me excited about
cucumber. (That's one of those sentences you don't want blogged... "No, I
meant cucumber the *framework*")

Aslak has done some really cool stuff here - I don't think we've started to
realise the power of combining tables and GWT scenarios - I have a hunch
that there will be some rather nice emergent behaviour once people become
familiar with it. Plus because cucumber is grammar-based, we will start
discovering other complementary formats to GWT.

Hmm - rather fun!


2008/8/29 David Chelimsky <dchelimsky at gmail.com>

> On Fri, Aug 29, 2008 at 1:37 PM, Bart Zonneveld <loop at superinfinite.com>
> wrote:
> > Hey list,
> >
> > This is a kinda quirky
>
> It's only quirky-ish.
>
> > question for this list, but I do think it belongs
> > here. I'm currently writing an app with users with different roles. Roles
> > are sequentially so to speak, so role 2 can do everything role 1 can, and
> so
> > on.
> > If I truly test my whole app, I should test all behaviour for each role,
> I
> > guess. I could solve that by doing some clever shared steps and all, but
> my
> > main question is this: should I test the behaviour of my entire app for
> each
> > role, or not, since that behaviour is embedded in the app itself?
>
> >From a testing perspective, you should test as much as you need to
> feel confident your app works.
>
> >From a refactoring perspective, you should test as much as you need to
> feel confident refactoring.
>
> >From a BDD perspective, the roles and permissions shouldn't exist
> until there are automated scenarios and code examples driving them
> into existence.
>
> The problem of multiple roles * multiple permissions (per role) can
> make this explode quite a bit. There is a relatively new feature in
> cucumber that lets you express things in a tabular format in addition
> to scenarios (think FIT, but plain text). So you can do this:
>
> Scenario: roles 3 and up can create a user
>  Given I am in the 'role 3' role
>  When I try to create a new user
>  Then I am allowed
>
>        | role   | action            | response |
>        | role 1 | create a new user | denied   |
>        | role 2 | create a new user | denied   |
>        | role 3 | create a new user | allowed  |
>        | role 4 | create a new user | allowed  |
>        | role 5 | create a new user | allowed  |
>
> (that looks right if you view in a monospace font)
>
> For my money (even thought it's free), this is the perfect situation
> for this format, as it allows you to express a number of cases/rules
> in a clear succinct way.
>
> HTH,
> David
>
> > thanks a bunch,
> > bartz
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-users
> >
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080829/61a5ad30/attachment.html>


More information about the rspec-users mailing list