diff options
| author | mo khan <mo@mokhan.ca> | 2016-05-01 17:44:33 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2016-05-01 17:44:33 -0600 |
| commit | 9e66649d97ab9d00a7b41cf420d96d4c8af2f930 (patch) | |
| tree | e615e7b5a11a416269984e2c9bf5e2312b3ec41f /spec/features | |
| parent | 115dfe33d4c1562d16791bf532da9dfe32919a22 (diff) | |
add capybara spec for loading gyms.
Diffstat (limited to 'spec/features')
| -rw-r--r-- | spec/features/gyms_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/features/gyms_spec.rb b/spec/features/gyms_spec.rb new file mode 100644 index 0000000..86a80ef --- /dev/null +++ b/spec/features/gyms_spec.rb @@ -0,0 +1,29 @@ +require 'rails_helper' + +feature "Gyms", type: :feature do + feature "viewing gyms" do + subject { GymsPage.new } + let!(:calgary_gym) { create(:gym, name: 'sait', location: create(:calgary)) } + let!(:edmonton_gym) { create(:gym, name: 'nait', location: create(:edmonton)) } + let(:user_session) { create(:active_session, location: create(:calgary)) } + + before :each do + page.set_rack_session(user_id: user_session.id) + end + + it 'loads the gyms closest to you' do + subject.visit_page + expect(subject).to be_on_page + expect(subject).to have_content(calgary_gym.name) + expect(subject).not_to have_content(edmonton_gym.name) + end + + it 'loads all the gyms' do + user_session.location.update_attributes(latitude: 0.0, longitude: 0.0) + subject.visit_page + expect(subject).to be_on_page + expect(subject).to have_content(calgary_gym.name) + expect(subject).to have_content(edmonton_gym.name) + end + end +end |
