Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7996399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:42:00+00:00 2026-06-04T14:42:00+00:00

I am following Michael’s ROR tutorial and creating user authentication system. There is an

  • 0

I am following Michael’s ROR tutorial and creating user authentication system. There is an admin privilige, which allows users to delete other users. Special ‘delete’ links appear on the users listing page when logged in as a priviliged admin user.
My App works fine but rspec tests are failing for a reason unknown to me.

I’ve separated the tests to another file spec/requests/sat_spec.rb and I am trying to use pry gem to debug it, but no success so far.

describe "delete links" do
  describe "as admin user" do
    let(:admin) { FactoryGirl.create(:admin) }
    before do
      sign_in admin
      visit users_path
      binding.pry          
    end
  it { should have_link('delete', href: user_path(User.first)) }

  it "should be able to delete another user" do
    expect { click_link('delete') }.to change(User, :count).by(-1)
  end    
end

Test Failures:

1) separated admin tests delete links as admin user 
 Failure/Error: it { should have_link('delete', href: user_path(User.first)) }
   expected link "delete" to return something
 # ./spec/requests/sat_spec.rb:25:in `block (4 levels) in <top (required)>'

2) separated admin tests delete links as admin user should be able to delete another user
 Failure/Error: expect { click_link('delete') }.to change(User, :count).by(-1)
 Capybara::ElementNotFound:
   no link with title, id or text 'delete' found
 # (eval):2:in `click_link'
 # ./spec/requests/sat_spec.rb:28:in `block (5 levels) in <top (required)>'
 # ./spec/requests/sat_spec.rb:28:in `block (4 levels) in <top (required)>'

What might by the problem here or more importantly how to debug it?

You can fork my code here https://github.com/tomek-rusilko/miniatury_katalog_2

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:42:02+00:00Added an answer on June 4, 2026 at 2:42 pm

    You expect your /users page to contain the list of users with ‘delete’ link next to them. But you didn’t fill your TEST db with simple users. It just contains one user, the admin. But according to your users/_user.html.erb this type of users doesn’t have ‘delete’ link. So, add at least one user creation statement and try again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am following Michael Hartl's RoR tutorial, and it is covering the basics of
I am completely new to ror and am following Michael Hartl's tutorial but I
I am following Michael Hartl's Rails Tutorial Here: http://ruby.railstutorial.org/chapters/modeling-and-viewing-users-one#top I use this command to
I am currently following Michael Hartl's tutorial on RoR and am trying to get
Have been following Rails Tutorial by Michael Hart rails version 3.0 on mac OS
I'm following the Rails Tutorial by Michael Hartl and I'm getting an unexpected error/failed
I want to use following xml webservice. www.musicbrainz.org/ws/2/artist/?query=artist:michael jackson which format is like below:
The following code is from a tutorial ( http://net.tutsplus.com/php/creating-a-php5-framework-part-1/ ), not mine. I have
New to Ruby on Rails and having a problem when following Michael Hartl's tutorial.I'm
I have this test from michael hartl book describe follower/following counts do let(:user) {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.