Sha256: cc8d352391c1b84a5c5aa6eaa26c304f817de9f1b80965ee92912e5d550ce8be

Contents?: true

Size: 1.26 KB

Versions: 10

Compression:

Stored size: 1.26 KB

Contents

include Warden::Test::Helpers
Warden.test_mode!

# Feature: User edit
#   As a user
#   I want to edit my user profile
#   So I can change my email address
feature 'User edit', :devise do

  after(:each) do
    Warden.test_reset!
  end

  # Scenario: User changes email address
  #   Given I am signed in
  #   When I change my email address
  #   Then I see an account updated message
  scenario 'user changes email address' do
    user = FactoryGirl.create(:user)
    login_as(user, :scope => :user)
    visit edit_user_registration_path(user)
    fill_in 'Email', :with => 'newemail@example.com'
    fill_in 'Current password', :with => user.password
    click_button 'Update'
    expect(page).to have_content 'You updated your account successfully.'
  end

  # Scenario: User cannot edit another user's profile
  #   Given I am signed in
  #   When I try to edit another user's profile
  #   Then I see my own 'edit profile' page
  scenario "user cannot cannot edit another user's profile", :me do
    me = FactoryGirl.create(:user)
    other = FactoryGirl.create(:user, email: 'other@example.com')
    login_as(me, :scope => :user)
    visit edit_user_registration_path(other)
    expect(page).to have_content 'Edit User'
    expect(page).to have_field('Email', with: me.email)
  end

end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
rails_apps_testing-0.3.6 lib/generators/testing/configure/templates/spec/devise/features/users/user_edit_spec.rb
rails_apps_testing-0.3.5 lib/generators/testing/configure/templates/spec/devise/features/users/user_edit_spec.rb
rails_apps_testing-0.3.4 lib/generators/testing/configure/templates/spec/devise/features/users/user_edit_spec.rb
rails_apps_testing-0.3.3 lib/generators/testing/configure/templates/spec/devise/features/users/user_edit_spec.rb
rails_apps_testing-0.3.2 lib/generators/testing/configure/templates/spec/devise/features/users/user_edit_spec.rb
rails_apps_testing-0.3.1 lib/generators/testing/configure/templates/spec/devise/features/users/user_edit_spec.rb
rails_apps_testing-0.3.0 lib/generators/testing/configure/templates/spec/devise/features/users/user_edit_spec.rb
rails_apps_pages-0.4.9 lib/generators/pages/users/templates/spec/features/users/user_edit_spec.rb
rails_apps_pages-0.4.8 lib/generators/pages/users/templates/spec/features/users/user_edit_spec.rb
rails_apps_pages-0.4.7 lib/generators/pages/users/templates/spec/features/users/user_edit_spec.rb