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 8114069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:02:18+00:00 2026-06-06T03:02:18+00:00

Updating, showing, and deleting users, exercises Is there a way to create an Rspec

  • 0

Updating, showing, and deleting users, exercises

Is there a way to create an Rspec test for User controller actions such as “create” and “new?”

I’m not quite clear on the difference between the two actions “create” and “new” themselves either; could someone please be so kind as to elaborate?

After creating the test how would I go about implementing the redirect_to root_path? I think I am supposed to include the “new” and “create” actions in the before_filter signed_in section but this doesn’t automatically redirect to the root.

I tried to get the tests to pass by modifying the users_controller.rb file as follows:

  def create
    if signed_in?
      redirect_to root_path
    else
      @user = User.new(params[:user])
      if @user.save
        sign_in @user
        flash[:success] = "Welcome to the Sample App!"
        redirect_to @user
      else
        render 'new'
      end
    end
  end
  • 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-06T03:02:21+00:00Added an answer on June 6, 2026 at 3:02 am
    1. Yes; and this is partially begun around 7.16 and elsewhere.
    2. One actually creates a user (create). One is for the page for creating a new user (new).
    3. Not sure I understand the question.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the railstutorial, why does the author choose to use this (Listing 10.25): http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users
In this book: http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users#code:current_user_p The author does the following: def current_user @current_user ||= User.find_by_remember_token(cookies[:remember_token])
When updating a DataTable with 1850-ish new rows to a FbDataAdapter I get a
After updating to Parsec 3.1 from 2.x, code using many1, such as word =
I added a new feature into an app which I'm updating for the app
I'm publishing an app on android market. Before updating it to a new version
I create a List showing data from a RecordStore. I tried to update a
How can I do an Ajax called based on a user updating a number
I have a simple script updating and showing a useraccount. (working with the management
In showing a colleague how to use SVN yesterday, we created a test folder

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.