>At first glance, that is really cool. We've also batted around some
>other names like #facet or #behavior.
LOL..I smile because we went through the same semantic struggles as well.
The funny thing is the rSpec project led us to our resolve. :-)
We basically came to this conclusion every object has a behavior but that
behavior is governed by a context or multiple context concerning that type.
Given that we are specifying how an object should behave under a certain
context, the DSL quickly took shape. About the only difference is we
introduced the term [concerning] instead of describe.
pseudo DSL:
these specs are concerning this [Type]
when this [type] is in this context
then specify that it should behave this way
In C# this DSL creates a lot of noise in the syntax! For example:
[Context, Concerning("EquationGenerator")]
public class When_initializing_the_EquationGenerator_with_one_and_five :
NBehave.NUnitSpecBase
{
protected override void Before_each_spec()
{
_generator = new EquationGenerator(_LowerBound, _UpperBound);
}
[Specification]
public void
Should_generate_equations_where_the_left_hand_side_is_greater_than_or_equal_to_the_lower_bound()
{
IList<Equation> equations = _generator.GenerateEquations();
foreach (Equation equation in equations)
{
equation.LeftHandSide.should_be_greater_than_or_equal_to
(_LowerBound);
}
}
[Specification]
public void
Should_generate_equations_where_the_left_hand_side_is_less_than_or_equal_to_the_upper_bound()...
[Specification]
public void
Should_generate_equations_where_the_right_hand_side_is_greater_than_or_equal_to_the_lower_bound()...
[Specification]
public void
Should_generate_equations_where_the_right_hand_side_is_less_than_or_equal_to_the_upper_bound()...
[Specification]
public void Should_generate_twenty_five_equations()...
}
I think we have taken this as far as it can go for a statically typed
language. Hence my interest in rSpec especially once MS gets IronRuby
baked! I can easily see Ruby taking over the MS culture once IronRuby is
complete.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users