Hey list, I'm refactoring some much-used functionality into a common_steps step group. Methods like this are in there:
steps_for :common do Given "a number of existing $types?" do |type| @initial_item_count = type.singularize.classify.constantize.count end When "the user adds an invalid $type" do |type| post "/#{type.pluralize}/create", type.to_sym => {} end When "the user adds a valid $type" do |type| post "/#{type.pluralize}/create", type.to_sym => valid_attributes end Then "there should be $number more $type? in the system" do | number, type| type.classify.constantize.count.should == (@initial_item_count + number.to_i) end Then "there should be an error message explaining what went wrong" do response.should have_tag('div#errorExplanation') end Then "the user should see the form again" do response.should have_tag('form[method=post]') end end This more or less works for me. However, I'm interested in two things. First, is this good practice? It's DRY, but I'm coupling my stories to these common steps in a way.. And second, is it possible to define a method in my specific stepgroup, that can be called from my common stepgroup? For instance, in the "user adds a valid type" step, I call a valid_attributes method. I'd like to define that on the specific stepgroup, but so far I haven't been able to get it called... thanks! bartz _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users