Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostsController tests not passing #6

Open
terenceponce opened this issue Jan 17, 2012 · 2 comments
Open

PostsController tests not passing #6

terenceponce opened this issue Jan 17, 2012 · 2 comments

Comments

@terenceponce
Copy link

I'm not sure why all the tests are passing on your machine, but on mine it's not. I tried imitating the tests you made for the ForumsController, but no dice. Here's the error that I've been getting:

Failures:

  1) PostsController GET 'show' returns http success
     Failure/Error: get :index
     AbstractController::ActionNotFound:
       The action 'index' could not be found for PostsController
     # ./spec/controllers/posts_controller_spec.rb:7:in `block (3 levels) in '

  2) PostsController GET 'new' returns http success
     Failure/Error: response.should be_success
       expected success? to return true, got false
     # ./spec/controllers/posts_controller_spec.rb:15:in `block (3 levels) in '

  3) PostsController GET 'create' returns http success
     Failure/Error: response.should be_success
       expected success? to return true, got false
     # ./spec/controllers/posts_controller_spec.rb:22:in `block (3 levels) in '

  4) PostsController GET 'edit' returns http success
     Failure/Error: response.should be_success
       expected success? to return true, got false
     # ./spec/controllers/posts_controller_spec.rb:29:in `block (3 levels) in '

  5) PostsController GET 'update' returns http success
     Failure/Error: response.should be_success
       expected success? to return true, got false
     # ./spec/controllers/posts_controller_spec.rb:36:in `block (3 levels) in '

  6) PostsController GET 'destroy' returns http success
     Failure/Error: response.should be_success
       expected success? to return true, got false
     # ./spec/controllers/posts_controller_spec.rb:43:in `block (3 levels) in '

I did a bit of investigation and I figured that the cause of the failure is that it requires authentication for it to pass, so I tried following this tutorial on the Devise Wiki. I guess it kind of worked because the cause of the failure changed:

ActiveRecord::RecordInvalid:
       Validation failed: Email has already been taken

I think Ryan Bates mentioned something about using sequences on Factory Girl to solve that problem, but I can't seem to get it right. I think this is the best that I can do regarding this issue. I've been trying to fix this for almost 2 hours now, but I don't think I'll be able to fix this on my own.

@danneu
Copy link
Owner

danneu commented Jan 17, 2012

Oops! I totally forgot about the other controller specs that you are referring to.

I've only put work into the Forums Controller Spec. The other controller specs are relics from the scaffold generator that I haven't replaced yet. Sorry to waste your attention on those.

Note: forums controller spec has one failure now on my machine because something on the app homepage (forums#index) is calling creator on a NilClass. Apparently the app index now breaks when you have a forum that doesn't have any topics/posts. You can try to resolve it if you want, else I'll get to it after I make some more test progress.

@terenceponce
Copy link
Author

Weird. I'm not having that error on my machine, so I don't know what I should do about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants