P
Patrick Fernie
Is there an equivalent to autotest for rspec (autospec?)? I've googled
around, but only came across a Rails plugin, which (perhaps obviously)
is very Rails-centric.
-P
around, but only came across a Rails plugin, which (perhaps obviously)
is very Rails-centric.
-P
They can contain anything except NUL bytes (the extended symbol
syntax). They are turned into class and method names automatically
(we need some special formatting for that due to Test::Unit
restrictions).
test/spec allows them since 0.2, and I use them to group contexts that
go together. Note that nothing is inherited, it's purely namespacing.
RSpec doesn't have them, and they aren't interesting in implementing
them AFAICT.
That's correct. We've really struggled with this because users want a
means of sharing context material, but we believe that nesting
contexts is going to lead to specs that are confusing to look at. We
believe that clarity supercedes DRY in specs, and so we haven't
supported this yet.
That said, you can include modules and get reuse that way:
module SomeHelperMethodsUsefulAcrossContexts
end
context "some context" do
include SomeHelperMethodsUsefulAcrossContexts
end
I'd be surprised if test/spec doesn't already support this out of the box.
Cheers,
David