From djberg96 at gmail.com Fri Dec 21 01:47:32 2012 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 20 Dec 2012 18:47:32 -0700 Subject: [test-unit-users-en:00102] omit_if, omit_unless as blocks Message-ID: Hi, What do you think about adding singleton level block forms of omit_if and omit_unless? That way we could group a block of tests together instead of writing an omit statement per test. For example, instead of this: test "something X" do omit_unless(@@admin) ... end test "something Y" do omit_unless(@@admin) ... end We could do this: omit_unless(@@admin) do test "something X" do ... end test "something Y" do ... end end Or is this getting too much like rspec? Anyway, just a thought. Cheers, Dan From kou at cozmixng.org Sat Dec 22 12:04:17 2012 From: kou at cozmixng.org (Kouhei Sutou) Date: Sat, 22 Dec 2012 21:04:17 +0900 (JST) Subject: [test-unit-users-en:00103] Re: omit_if, omit_unless as blocks In-Reply-To: References: Message-ID: <20121222.210417.586413801068584589.kou@cozmixng.org> Hi, Thanks for your suggestion. In "[test-unit-users-en:00102] omit_if, omit_unless as blocks" on Thu, 20 Dec 2012 18:47:32 -0700, Daniel Berger wrote: > What do you think about adding singleton level block forms of omit_if > and omit_unless? That way we could group a block of tests together > instead of writing an omit statement per test. I like the following syntax: sub_test_case("For admin") do setup do omit unless admin? end test "something X" do ... end test "something Y" do ... end end rather than: > For example, instead of this: > > test "something X" do > omit_unless(@@admin) > ... > end > > test "something Y" do > omit_unless(@@admin) > ... > end > > We could do this: > > omit_unless(@@admin) do > test "something X" do > ... > end > > test "something Y" do > ... > end > end Because we already have "class SubTestCase < self" and "sub_test_case" syntaxes for grouping tests. Or simply: unless @@admin test "something X" do ... end test "something Y" do ... end end The above case doesn't show omit messages... Thanks, -- kou