El 19/07/2010, a las 16:20, Phillip Koebbe escribió: > On 2010-07-19 5:38 AM, Wincent Colaiuta wrote: >> I don't necessarily think so. Matt says you can probably do this right now >> by using macros. I don't actually know what he means by that, but I do know >> that there are cases where I sometimes want a bunch of nearly identical >> specs, and I generate them in code using enumeration or some other means; >> ie. dumb example: >> >> [:foo, :bar, :baz].do |thing| >> describe "#{thing} dimensions" do >> it 'has length' do >> thing.to_s.length.should> 0 >> end >> end >> end >> > > Glad to see I'm not the only one that does this. :)
Yeah, I think it's a legitimate technique, as long as you don't get too carried away with it. I use it, for example, for some code quality specs: Wincent::SOURCE_FILES.each do |file| describe file do it 'contains no trailing whitespace' do file.should_not have_trailing_whitespace end it 'contains no tabs' do file.should_not contain_tabs end it 'has a newline at the end' do file.should have_newline_at_end_of_file end end end Cheers, Wincent _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users