Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby User Authentication with Rails Password Hashing and Sign In Integration testing authentication

I feel like some of the files changed offline here; anyone else have this issue?

When I began this step, I noticed that this code was in Jason's test file already.

I can't figure out if I missed adding it somewhere, or if it was something mysteriously added between videos.

      it "redirects to the todo lists path" do
        post :create, {:user => valid_attributes}, valid_session
        response.should redirect_to(todo_lists_path)
      end

      it "sets the flash success message" do
        post :create, {:user => valid_attributes}, valid_session
        expect(flash[:success]).to eq("Thanks for signing up!")
      end

If you're wondering, it's throwing failures as well, so I'm just trying to figure out where the heck it came from. :grinning:

Yep very frustrating.....

3 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Yeah, they seem to magically add code between videos and the courses of this whole series, get used to it and check the downloaded code under the videos form time to time if things don't work properly ;)

Do you ever find that really really frustrating?

Asking for a friend. :grinning:

Seriously though, I'm meticulous about typing everything in during every video, and making sure it matches. But then I get to points where like, there's an entire tab at the top of the screen that we never built, and things don't function properly, and I start to just get frustrated with it--because I'm new enough that I don't know if I missed something, or if the files simply changed, no explanation given. :confused:

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

It is VERY frustrating and during my first weeks of Rails with Treehouse I had a ragequit at some point. This was even before Odot was published. The cause of my frustration was the differences between Rails 3 and 4 and the fact that the Treebook course was so outdated. When Odot was published I got frustrated because there was a lot going on on screen without any explanation and most of the code was tests. I want to love Treehouse's Rails courses but they won't let me love them :(. May be one day.

I actually don't mind that it's so test-driven--I just get bummed out when the code changes in between sections, and its unclear which has changed. During the final course in the track I ended up having to copy and paste the whole thing right before the last video or two. :confused:

But I also finished it! Woohoo!

Regarding the TTD approach - I haven't seen anyone explicitly say this, but the general feeling I get from the RoR community is that you learn by writing tests even if you don't understand them. In other words, learn by rote, drill it into your little bleeping head, and the rspec (or other TTD / BDD) syntax will eventually make sense.

Personally, I'm not a big fan of that approach, but I understand the philosophy. It will take several iterations before I grasp it well. After Treehouse, I'll be doing the Michael Hartl Rails Tutorial (https://www.railstutorial.org/book) and then maybe the Odin Project (http://www.theodinproject.com/home).

I've noticed that some instructors' project files include the final output of the stage, whereas other instructors include the starting code, expecting that you'll add it as you go along. IIRC, most of the ruby courses include the final output.

Thanks for the links! The Hartl one gets mentioned all over, definitely! I wasn't familiar with the Odin Project, but I like that you build projects alongside the curriculum!

Maximiliane Quel
PLUS
Maximiliane Quel
Courses Plus Student 55,489 Points

I know this is not exactly a recent post, but for anyone who is reading this, because they ran into the same issue and want to follow this video without having to dig through the entire downloaded version here are the steps that are missing:

in users_controller_spec.rb replace:

it "redirects to the created user" do
  post :create, {:user => valid_attributes}, valid_session
  response.should redirect_to(User.last)
end

with:

it "redirects to the todo lists path" do
  post :create, {:user => valid_attributes}, valid_session
  response.should redirect_to(todo_lists_path)
end

it "sets the flash success message" do
  post :create, {:user => valid_attributes}, valid_session
  expect(flash[:success]).to eq("Thanks for signing up!")
end

to make these tests pass write:

in users_controller.rb replace the commented line with:

# format.html { redirect_to @user, notice: 'User was successfully created.' }
format.html { redirect_to todo_lists_path, success: "Thanks for signing up!" }

in application_controller.rb:

add_flash_types :success

when you run the test

bin/rspec spec/controllers/users_controller_spec.rb

it should pass and you should be able to proceed where the video starts. Can't guarantee that nothing else has changed but keeping my fingers crossed

You are simply fantastic. I thought I was going insane when I suddenly couldn't follow along with the video. You just saved me who-knows how much aggravation!