Skip to content

Instantly share code, notes, and snippets.

@thiagoramos23
Created November 8, 2014 03:45
Show Gist options
  • Select an option

  • Save thiagoramos23/b56a4ad1f209f9ac70f8 to your computer and use it in GitHub Desktop.

Select an option

Save thiagoramos23/b56a4ad1f209f9ac70f8 to your computer and use it in GitHub Desktop.
index_residence_page_object
class IndexResidencePage < BaseObject
def visit_page
visit admin_residences_path
self
end
def has_residence?(residence)
content = find(:xpath, '//table/tbody/tr')
has_expected_fields_in_table(content, residence)
end
def has_message?(message)
has_content?(message)
end
def click_on_new
click_link I18n.t('helpers.links.new')
NewResidencePageObject.new
end
def click_on_edit
click_on I18n.t('helpers.links.edit')
EditResidencePageObject.new
end
def click_on_remove
click_on I18n.t('helpers.links.destroy')
self
end
private
def has_expected_fields_in_table(content, residence)
content.has_content?(residence.name_of_patio) && content.has_content?(residence.cep)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment