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

  • SEARCH
  • Home
  • 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 7429763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:01:35+00:00 2026-05-29T09:01:35+00:00

The first rails app I wrote used the hand-rolled authentication from railstutorial . For

  • 0

The first rails app I wrote used the hand-rolled authentication from railstutorial.

For my second app I’m using Clearance. I’m trying to write the integration tests for whether clicking the sign in/sign out links have worked. In the railstutorial version I can use the following:

describe "success" do
  it "should sign a user in and out" do
    user = Factory(:user)
    visit signin_path
    fill_in :email,    :with => user.email
    fill_in :password, :with => user.password
    click_button
    controller.should be_signed_in
    click_link "Sign out"
    controller.should_not be_signed_in
  end
end

How do I do the equivalent thing with clearance? I just can’t work it out. It seems to be telling me that controller is nil.

  • 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-05-29T09:01:36+00:00Added an answer on May 29, 2026 at 9:01 am

    I did the EXACT same thing, read Rails Tutorial and then started my own app using Clearance. Users seemed like the right starting point, so that’s where I started. I hadn’t even replaced the default static home page that displays Rails links and such. I believe that was actually the problem. Clearance doesn’t define user profile pages or anything, so when you sign in it redirects you to the home page (unless you were on your way somewhere else but needed to sign in). The default home page is just a static file, so it’s not running through the typical Rails request cycle and doesn’t load any of the controllers.

    I ended up just adding a super simple Pages controller (like in the Rails Tutorial, chapter 3) so it would redirect to dynamic page after signing in. This made the test above almost pass. The last edit I needed to get things working was

    click_link "Sign Out", :method => :delete
    

    Here, I specified that click_link should be using the :delete method instead of :get, which it aparently does by default. I’m still rather new to Rails, barely finished the book a few days ago, so I’m not sure why just click_link worked in the book but not in my app (maybe the move from Rails 3.0 to 3.1?), but this got everything passing.

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

Sidebar

Related Questions

I'm new to rails and trying to write my first app. I have a
I am writing my first rails app. It needs to aggregate some data from
Hey, I'm writing my first Rails app, and I'm trying to replace the underscores
First as a note I am using this plugin in a Rails app. Ok
I've been trying to build my first rails app and have gotten stuck on
I am trying to deploy my first rails app and struggling a bit. My
I'm creating my first rails app, and using the standard prototype library for some
I've been trying to setup my first rails app--I'm okay at stumbling around on
I'm trying to write an app in rails 3 and I'm having some trouble
In my first rails app I'm trying to use form_for and fields_for to create

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.