Forum: RSpec Indentation Conventions for Ruby and Cucumber

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mikel L. (Guest)
on 2008-12-03 13:51
(Received via mailing list)
On Thu, Nov 27, 2008 at 4:28 PM, Aslak Hellesøy
<removed_email_address@domain.invalid>wrote:

> When (if) this thread ends, let's start a discussion about indentation
> conventions!
>

Oh... let the pleasure be mine!... and why wait?

_EVERYONE_ knows that the only way to indent ruby code is 2 plain
spaces.
 Tabs are known to be the source of all evil and 4 spaces obviously
wastes
space and bandwidth...

Anyone else who says otherwise is obviously and irrefutably misguided :D


Mikel
<tongue firmly in cheek>
Andrew P. (Guest)
on 2008-12-03 16:45
(Received via mailing list)
Oh but cucumber features so want to be idented on the I

 Scenario: Anonymous user can not duplicate a un-activated account
   Given I am an anonymous user
     And a registered user Fred exists
    When I signup as Fred
    Then I should see an error

Really need to view above with a monspaced font - if its not coming out
that
way in your mail reader.

Andrew

2008/12/3 Mikel L. <removed_email_address@domain.invalid>:
Fernando García Samblas (Guest)
on 2008-12-04 18:57
(Received via mailing list)
Andrew P. escribió:
> Oh but cucumber features so want to be idented on the I
>
>  Scenario: Anonymous user can not duplicate a un-activated account
>    Given I am an anonymous user
>      And a registered user Fred exists
>     When I signup as Fred
>     Then I should see an error
>
> Really need to view above with a monspaced font - if its not coming
> out that way in your mail reader.

+0.66 :)

I like to indent this way, but within a given, when or then block:

 Scenario: Anonymous user can not duplicate a un-activated account
   Given I am an anonymous user
     And a registered user Fred exists
   When I signup as Fred
   Then I should see an error

Great idea, I love conventions!!!

Nando

> >
> > _______________________________________________
> http://rubyforge.org/mailman/listinfo/rspec-users
--
Fernando García Samblas
removed_email_address@domain.invalid
http://nando.lacoctelera.com

The Cocktail
C/ Salamanca 17
28020 Madrid
+34 91 567 06 05
Peter J. (Guest)
on 2008-12-04 21:15
(Received via mailing list)
On Wed, Dec 3, 2008 at 9:27 AM, Andrew P. <removed_email_address@domain.invalid>
wrote:
> Oh but cucumber features so want to be idented on the I
>
>  Scenario: Anonymous user can not duplicate a un-activated account
>    Given I am an anonymous user
>      And a registered user Fred exists
>     When I signup as Fred
>     Then I should see an error

I have to disagree.  I find the jagged margin looks messy.  I would
never indent other prose this way, so why would I indent my features
this way?  They're not code, they're prose.  They're not written to be
parsed, they're written to be read like a story.

Peter
Andrew P. (Guest)
on 2008-12-04 23:33
(Received via mailing list)
Definitely a matter of taste. A few things

1) syntax highlighting seems to make aligning on the I more preferable
2) And's feel like there nested
3) Maybe its my programmers eye reading and looking for matches rather
than
reading the scenario as a whole

Is a feature prose? Seems closer to poetry in layout at least


2008/12/4 Peter J. <removed_email_address@domain.invalid>
Zach D. (Guest)
on 2008-12-04 23:44
(Received via mailing list)
On Thu, Dec 4, 2008 at 2:14 PM, Peter J. <removed_email_address@domain.invalid>
wrote:
> never indent other prose this way, so why would I indent my features
> this way?  They're not code, they're prose.  They're not written to be
> parsed, they're written to be read like a story.

+1 to what Peter said,


--
Zach D.
http://www.continuousthinking.com
http://www.mutuallyhuman.com
Mikel L. (Guest)
on 2008-12-06 14:26
(Received via mailing list)
On Thu, Dec 4, 2008 at 1:27 AM, Andrew P. <removed_email_address@domain.invalid>
wrote:

>
The problem with that however is that it is not compliant with
Internationalization standards...

Not to mention it would then naturally bias someone toward using an
enforced
I.

What if I didn't want to use an "I", but an "it" say, in terms of an API
that is being talked to by another system...
Andrew P. (Guest)
on 2008-12-07 09:31
(Received via mailing list)
Original post was somewhat flippant :)

To be more precise. This style is

  "aligning on the first letter of the second word"

and basically is treating the first word as a label and the rest as
content,
and using indentation to differentiate (hopefully clearly)

Andrew


2008/12/6 Mikel L. <removed_email_address@domain.invalid>
Pat M. (Guest)
on 2008-12-08 22:32
(Received via mailing list)
I think that's ugly.  Better to use syntax highlighting in an editor,
imo.

Pat


"Andrew P." <removed_email_address@domain.invalid> writes:
This topic is locked and can not be replied to.