Module: PageRight::ImageHelper

Defined in:
lib/page_right/image_helper.rb

Instance Method Summary collapse

Instance Method Details

#is_image_in_section?(section, image, count, flag = true) ⇒ Boolean

Check that ‘count’ number of ‘image’s is in a ‘section’ of css, set flag to check that it/they isn’t/arn’t

Returns:

  • (Boolean)


4
5
6
7
8
9
10
# File 'lib/page_right/image_helper.rb', line 4

def is_image_in_section?(section, image, count, flag=true)
  if flag
    assert page.has_selector?(:css,"#{section} img[src$='/assets/#{image}']", count: count), "Error: #{count} #{image}(s) not found in #{section} !"
  else
    assert !page.has_selector?(:css,"#{section} img[src$='/assets/#{image}']", count: count), "Error: #{count} #{image}(s) found in #{section} !"
  end
end