How to set “programmatically”\“iteratively” each class object attribute to a value?
问题 I am using Ruby on Rails 3.0.9 and RSpec 2. I am trying to refactoring some spec file in the following way (in order to test with less code similar class object attribute values): [ :attribute_a, :attribute_b, :attribute_c ].each do |attr| before do # HERE I would like to set the "current" 'attr' related to the # class object instance 'attribute_< letter >' (read below for # more information) each time the iterator is called (note: all # following attributes are NOT attr_accesible - for that