Closed axelkanakan closed 9 years ago
Could you include a link to your repo on GH too please?
On 13 Nov 2014, at 09:28, krillencoder notifications@github.com wrote:
Got bin/rspec spec/controllers/comments_controller_spec.rb to pass but bin/rspec comes back with the error
1) Assigning permissions Changing states for a ticket Failure/Error: within("#ticket .state") do Capybara::ElementNotFound: Unable to find css "#ticket .state"
./spec/features/admin/assigning_permissions_spec.rb:95:in `block (2 levels) in '
this only happened after I added the "if cannot?" code in the comment controller. Not sure what to change here...
— Reply to this email directly or view it on GitHub.
@krillencoder I cloned the repo tonight and was unable to see any errors:
75 examples, 0 failures
Have you fixed this problem? If so, was it a problem with the book?
I 'm still struggling with it, I just pushed it again to make sure.
I can verify this issue exists in your repo now. I will see what the cause of it is.
Thank you, I'll keep troubleshooting too
Quite a rather tricky one to track down... but we got there in the end.
The problem with this is the code in SessionsController
of all things. It does this:
user = User.where(:name => params[:signin][:name]).first
The user_factory
code creates both users and admins with the same name ("username")... which means that there's two users with the name "username", an admin and a normal user. The code selects the admin user which doesn't have the explicit permission to change states of a ticket, and therefore once that user is signed in they can't change the state.
Ultimately this comes down to the code from Chapter 6 which built the authentication part of your application. I've recently rewritten this chapter to improve the authentication code. This chapter hasn't been published yet, but I believe the code in the chapter will fix your problem.
You can fix this by changing the user_factory
code to generate unique usernames for the users:
sequence(:name) { |n| "username#{n}" }
Although I would probably advise you to go through Chapter 6 again once it has been published.
Very sorry that this code was not up to snuff.
Do you know when it'll be published?
Nevermind I got to pass thanks for the help
No timeframe on the publication at the moment as it relies on a large number of factors. Should be by Christmas :)
On 25 Nov 2014, at 05:22, krillencoder notifications@github.com wrote:
Do you know when it'll be published?
— Reply to this email directly or view it on GitHub.
Thanks, man. It was very helpful for me
Got bin/rspec spec/controllers/comments_controller_spec.rb to pass but bin/rspec comes back with the error
1) Assigning permissions Changing states for a ticket Failure/Error: within("#ticket .state") do Capybara::ElementNotFound: Unable to find css "#ticket .state"
this only happened after I added the "if cannot?" code in the comment controller. Not sure what to change here...