Sha256: 890bc2817f912b5c006824b9a019c768695908a6af7b6e36c3f39f89171175f5
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
include Warden::Test::Helpers Warden.test_mode! # Feature: User profile page # As a user # I want to visit my user profile page # So I can see my personal account data feature 'User profile page', :devise do after(:each) do Warden.test_reset! end # Scenario: User sees own profile # Given I am signed in # When I visit the user profile page # Then I see my own email address scenario 'user sees own profile' do user = FactoryBot.create(:user) login_as(user, :scope => :user) visit user_path(user) expect(page).to have_content 'User' expect(page).to have_content user.email end # Scenario: User cannot see another user's profile # Given I am signed in # When I visit another user's profile # Then I see an 'access denied' message scenario "user cannot see another user's profile" do me = FactoryBot.create(:user) other = FactoryBot.create(:user, email: 'other@example.com') login_as(me, :scope => :user) Capybara.current_session.driver.header 'Referer', root_path visit user_path(other) expect(page).to have_content 'Access denied.' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_apps_testing-0.3.13 | lib/generators/testing/configure/templates/spec/devise/features/users/user_show_spec.rb |