Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
it "is memoized to the last set constant" do m = Module.new m.name.should == "" begin ModuleSpecs.const_set(:X, m) ModuleSpecs::X.name.should == "ModuleSpecs::X" ModuleSpecs.const_set(:Y, m) ModuleSpecs::X.name.should == "ModuleSpecs::X" ModuleSpecs::Y.name.should == "ModuleSpecs::X" ensure ModuleSpecs.send :remove_const, :X ModuleSpecs.send :remove_const, :Y rescue nil end m.name.should == "ModuleSpecs::X" m = Module.new m.name.should == "" begin ModuleSpecs.const_set(:X, m) ModuleSpecs.const_set(:Y, m) ModuleSpecs::X.name.should == "ModuleSpecs::Y" ModuleSpecs::Y.name.should == "ModuleSpecs::Y" ensure ModuleSpecs.send :remove_const, :X ModuleSpecs.send :remove_const, :Y rescue nil end m.name.should == "ModuleSpecs::Y" end
This paste will be private.
From the Design Piracy series on my blog: