Personally I don't like the first example. I also don't believe it resembles cucumber at all.
It's certainly more closer to a documentation string (the ones you see in python or common lisp).
In any case given the following:
describe 'if the user is an admin' do
versus
describe '#admin?' do
Ignoring the fact that the author is ignoring BDD here, I certainly like the first one more, even if the user part is a bit redundant.
Nevertheless, what the author has done is commendable but there are few cases there that I just can't agree with. I don't see anything really wrong about them, it's just that in real life things can get complicated.
To be honest, I think both styles are good practice, but it totally depends on the context. For example, if I want to describe how the "#admin?" method is working, I'll use
describe "#admin?" do ...
but if I'm describing a different method, that does different things depending on whether the user is an admin or not, I'll do the following:
describe "#some_other_method" do
describe "if the user is an admin" do
...
So you can mix and match both styles, depending on what exactly you're describing (and it's context).
If you're looking at the OP more closely, it even says this is only recommended for "describing methods".
It's certainly more closer to a documentation string (the ones you see in python or common lisp).
In any case given the following:
versus Ignoring the fact that the author is ignoring BDD here, I certainly like the first one more, even if the user part is a bit redundant.Nevertheless, what the author has done is commendable but there are few cases there that I just can't agree with. I don't see anything really wrong about them, it's just that in real life things can get complicated.