Commit 8710993
Changed files (3)
app
assets
javascripts
templates
spec
features
support
pages
app/assets/javascripts/templates/home_gym.ractive
@@ -11,7 +11,7 @@
{{#if searching}}
<p><i class="fa fa-spinner fa-pulse"></i></p>
{{/if}}
-<form>
+</form>
<div id="results">
<table>
spec/features/profiles_spec.rb
@@ -37,5 +37,23 @@ feature "Profiles", type: :feature do
I18n.translate("profiles.edit.profile_update_success")
)
end
+
+ it "allows me to choose my home gym", js: true do
+ gym = build(:gym)
+ allow(Gym).to receive(:create_from_yelp!).and_return(gym)
+
+ link_text = I18n.translate("profiles.edit.choose_home_gym")
+ subject.click_link(link_text)
+ within('#gym-search form') do
+ fill_in 'q', with: 'sait'
+ fill_in 'city', with: 'calgary'
+ click_button("Search")
+ end
+ subject.wait_for_ajax
+ subject.click_button('Mine')
+ subject.wait_for_ajax
+ subject.save_changes
+ expect(page).to have_content(gym.name)
+ end
end
end
spec/support/pages/edit_profile_page.rb
@@ -9,6 +9,12 @@ class EditProfilePage < PageModel
within(".edit_profile") do
page.choose(gender.to_s.titleize)
page.choose(social_tolerance.to_s.titleize)
+ end
+ save_changes
+ end
+
+ def save_changes
+ within(".edit_profile") do
click_button translate("profiles.edit.save")
end
end