Sha256: 62b3970cfb3e4c15992970734a9a22211c32e5dd6f67c2e06f501efb5da22e32
Contents?: true
Size: 1.07 KB
Versions: 11
Compression:
Stored size: 1.07 KB
Contents
$shared_specs = {} module Kernel # Stores the passed in block for inclusion in test cases. # # share "User" do # it "should authenticate" do # "me".should == "me" # end # end # # describe "User, in general" do # shared_specs_for 'User' # end # # describe "User, in another case" do # shared_specs_for 'User' # end # # 2 tests, 2 assertions, 0 failures, 0 errors def share(name, &specs_block) $shared_specs[name] = specs_block end end module SharedSpecsInclusionHelper # Include the specified shared specs in this test case. # # share "User" do # it "should authenticate" do # "me".should == "me" # end # end # # describe "User, in general" do # shared_specs_for 'User' # end # # describe "User, in another case" do # shared_specs_for 'User' # end # # 2 tests, 2 assertions, 0 failures, 0 errors def shared_specs_for(name) self.class_eval &$shared_specs[name] end end Test::Unit::TestCase.send(:extend, SharedSpecsInclusionHelper)
Version data entries
11 entries across 11 versions & 3 rubygems