> Use the described class: > > shared_examples "a nameable thingie" do |klass| > describe "#build_name" do > it "it adds the collection of arguments to the base components and > formats them for a form element name attribute" do > described_class.new(nil,nil).build_name(:lol, :lollerskates, > :roflcopter).should == "lol[lollerskates][roflcopter]" > end > end > end
But what happens if the classes do not have the same argument expectations, such as: class Foo include NameBuilder def initialize(arg1) ... end end class Bar include NameBuilder def initialize(arg1, arg2, arg3) ... end end ... In this case, "described_class.new(nil, nil)" is not going to work out very well. Patrick J. Collins http://collinatorstudios.com _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users