Files
nairobi/spec/features/sessions_spec.rb
Bertocq 7f14544f71 Enable Capybara/CurrentPathExpectation cop & fix issues
Read cop description http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation to better understand reasons behind enforcing this rule

On some cases the `only_path: true` was needed as argument of `have_current_path` matcher to avoid comparing the url parameters and just checking the path.
2018-01-06 23:31:41 +01:00

24 lines
556 B
Ruby

require 'rails_helper'
feature 'Sessions' do
scenario 'Staying in the same page after doing login/logout' do
user = create(:user, sign_in_count: 10)
debate = create(:debate)
visit debate_path(debate)
login_through_form_as(user)
expect(page).to have_content('You have been signed in successfully')
expect(page).to have_current_path(debate_path(debate))
click_link 'Sign out'
expect(page).to have_content('You have been signed out successfully')
expect(page).to have_current_path(debate_path(debate))
end
end