On Jul 29, 2011, at 12:36 PM, John Hinnegan wrote:
> I would like to turn this:
>
> describe TestClass do
> before :all do
> # set some config
> end
> after :all do
> # restore some config
> end
> # do a bunch of tests to this
> end
>
> into
>
> describe TestClass do
> with_config_value(X)
>
> # do a bunch of tests to this
> end
>
>
> Basically, I want to include before :all and after :all clauses into a test.
> However, I do not want this to apply toa ll tests.
>
> Thanks in advance.
There a number of ways to do this, but if you really just want a method, then
just write one!
def with_config_value(foo)
before(:all) do
# stuff that can access foo
end
after(:all) do
# more stuff that can use foo
end
end
HTH,
David
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users