[Ironruby-core] RSpec Test Format
lists at ruby-forum.com
Tue Jul 7 14:44:27 EDT 2009
Mohammad Azam wrote:
> I have done BDD in C# and my question is that how Spec in IronRuby makes
> it easier. Here is what my test looks like:
> <snip test code....>
> Is this the normal way of writing unit test BDD style using Spec and
> IronRuby or am I missing something?
I'm definitely no BDD expert, but I'll try to take a stab at it.
Apologies if I put my foot in my mouth.
People actually using BDD full-time, please chime in and/or shoot me
Personally, I believe that some of this is just aesthetics, and some of
it is actually aiming to make you think about making your libraries'
intent as clear as possible.
I think you can refactor as you go, and when the specifications read
close to natural language, you've gotten somewhere.
Re: Your specific question about what RSpec brings that C# can't
I think it's the same as most ruby vs. C# issues, ruby gets out of our
way, where C# simply isn't able to.
I'd say the closest you get (arguably) in C# is MSpec:
Where you have to work around what the C# compiler needs, you have to
write things like:
Because of = () =>
Check here for a simple MSpec example:
I'm not trying to knock MSpec at all, but if you look at what you've
written above to achieve the same context/specification style, I think
you might agree ruby does a better job getting out of your way to let
you do what you intend.
The C# compiler needs a lot more to be happy, so MSpec does its very
best to get around that.
There is a lot of good material around RSpec and Cucumber, and the art
of writing specifications for it as well.
Posted via http://www.ruby-forum.com/.
More information about the Ironruby-core