summaryrefslogtreecommitdiff
path: root/spec/support/pages/edit_profile_page.rb
blob: 42b68e853bedd5359bac646adbc7142962f7c3ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require_relative "../page_model.rb"

class EditProfilePage < PageModel
  def initialize(user)
    super edit_profile_path(user)
  end

  def change(gender: :male, social_tolerance: :low)
    within(".edit_profile") do
      page.choose(gender.to_s.titleize)
      page.choose(social_tolerance.to_s.titleize)
    end
  end

  def choose_home_gym(city:, name:)
    within("#gym-search form") do
      fill_in "q", with: name
      fill_in "city", with: city
      click_button("Search")
    end
    wait_for_ajax
    click_button("Mine")
    wait_for_ajax
  end

  def save_changes
    within(".edit_profile") do
      click_button translate("profiles.edit.save")
    end
  end
end