Method: Polygallery::CapybaraHelpers#change_polyphoto_in_form

Defined in:
lib/polygallery/capybara_helpers.rb

#change_polyphoto_in_form(photo_index = 0, table_id = 'photos', file_to_use = nil) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/polygallery/capybara_helpers.rb', line 33

def change_polyphoto_in_form(photo_index=0, table_id='photos', file_to_use=nil)
  if photo_index.is_a? File
    file_to_use = photo_index; photo_index = 0 end
  if table_id.is_a? File
    file_to_use = table_id; table_id = 'photos' end
  if photo_index.is_a? String
    table_id = photo_index; photo_index = 0 end
  file_to_use ||= get_random_photo
  within select_polyphoto_tr(photo_index, table_id) do
    find('input[id$="_photo"]').set file_to_use
    yield if block_given?
  end
end