I have a helper that generates HTML for dynamically adding items to a
class. It uses Formtastic for the fields:
link_to_function "Add competition class" do |page|
CompetitionClass.new, :child_index => 'NEW_RECORD' do |p|
html = render(:partial => 'competition_class_form', :object
page << "$('#competition_classes').append('#
Now I have a problem with testing this with RSpec. I can mock the
SemanticFormBuilder but that does not really check that the correct
HTML is being added. I also have problems mocking the block which
leaves it unseen by Rcov and 100% coverage is lost.
Does anyone have a good way of testing things like these?