Module: PageRight::TextHelper

Defined in:
lib/page_right/text_helper.rb

Instance Method Summary collapse

Instance Method Details

#is_text_in_page?(content, flag = true) ⇒ Boolean

Check that the text ‘content’ is on the page, set flag to check that it isn’t

Returns:

  • (Boolean)


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

def is_text_in_page?(content, flag=true)
  if flag
    assert page.has_content?("#{content}"), "Error: #{content} not found page !"
  else
    assert !page.has_content?("#{content}"), "Error: #{content} found in page !"
  end
end

#is_text_in_section?(section, content, flag = true) ⇒ Boolean

Check that the text ‘content’ is within a particular css section, set flag to check that it isn’t

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
21
# File 'lib/page_right/text_helper.rb', line 13

def is_text_in_section?(section, content, flag=true)
  within("#{section}") do
    if flag
      assert page.has_content?("#{content}"), "Error: #{content} not found in #{section} !"
    else
      assert !page.has_content?("#{content}"), "Error: #{content} found in #{section} !"
    end
  end
end