I made it up to Chapter 9 of the Ruby on Rails tutorial, and added functionality of my own to lock a user when they first sign up, such that an admin has to go in and approve ("unlock") their id before a new user has access to the site. I added a :locked boolean attribute that works just like the :admin attribute of the User object. I have that all working now, but I'm having trouble writing a simple test for it. I added the following test to user\_pages\_spec.rb, just under the hierarchy "pagination" - "as an admin user":

```
describe "as an admin user to unlock new users" do
    let(:admin) { FactoryGirl.create(:admin) }
    let(:locked_user) { FactoryGirl.create(:locked) }
    before do
      sign_in admin
      visit users_path
    end

    it { should have_link('unlock', href: user_path(locked_user)) }
    it { should_not have_link('unlock', href: user_path(admin)) }
end

```

and to support the creation of a "locked" user, added this to factories.rb:

```
factory :locked do
    locked true
end

```

I can confirm manually through Firefox that the unlocking link shows up, but I'm still getting the following failure:

```
  1) User pages index pagination as an admin user to unlock new users 
     Failure/Error: it { should have_link('unlock', href: user_path(locked_user)) }
       expected link "unlock" to return something
     # ./spec/requests/user_pages_spec.rb:64:in `block (5 levels) in <top (required)>'

```

I'm interested in knowing a) why this fails :), but also b) how to go about debugging a problem like this. How do I tell what the test is actually "seeing"? I tried rails-pry with a different problem as suggested by another stackoverflow user, but in this case I've found it of limited use.

Any ideas or suggestions would be much appreciated. Thanks in advance!

-Matt