Skip to content

Instantly share code, notes, and snippets.

@thiagoramos23
Last active August 29, 2015 14:08
Show Gist options
  • Select an option

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

Select an option

Save thiagoramos23/95787a20cf6b2eb9d032 to your computer and use it in GitHub Desktop.
new_residence_page_object
class NewResidencePageObject < BaseObject
def has_current_path?(path)
current_path == path
end
def fill_in_with_residence(residence)
find("#residence_latitude").set(residence.latitude)
find("#residence_longitude").set(residence.longitude)
fill_in I18n.t('activerecord.attributes.residence.type_of_patio'), with: residence.type_of_patio
fill_in I18n.t('activerecord.attributes.residence.name_of_patio'), with: residence.name_of_patio
find("#residence_number").set(residence.number)
fill_in I18n.t('activerecord.attributes.residence.municipality'), with: residence.municipality
select('RJ', from: I18n.t('activerecord.attributes.residence.uf'))
fill_in I18n.t('activerecord.attributes.residence.cep'), with: residence.cep
fill_in I18n.t('activerecord.attributes.residence.complement'), with: residence.complement
fill_in I18n.t('activerecord.attributes.residence.residencial_phone'), with: residence.residencial_phone
choose(I18n.t('activerecord.attributes.residence.housing_situations.own'))
choose(I18n.t('activerecord.attributes.residence.type_residences.house'))
fill_in I18n.t('activerecord.attributes.residence.number_of_residents'), with: residence.number_of_residents
choose(I18n.t('activerecord.attributes.residence.conditions_of_land_uses.owner'))
choose('residence_has_energy_power_true')
end
def make_blank_field(field)
find(field).set('')
end
def click_on_save
click_on 'Criar Domicílio'
IndexResidencePage.new
end
def has_invalid_message_on_div?(klass)
within(klass) do
has_content?(I18n.t('errors.messages.blank'))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment