The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Askar (112) [Avatar] Offline
#1
I'm having this from the previous version of the ebook.

Repo https://github.com/tenzan/ticketee

For some reason, I keep failing with spec/policies/project_policy_spec.rb

As per ebook, I should have error:

1) ProjectPolicy show? blocks anonymous users
   Failure/Error: expect(subject).not_to permit(nil, project)
   NoMethodError:
     undefined method `roles' for #<Project:0x007fa12c854510>
   # ...
   # ./app/policies/project_policy.rb:9:in `show?'


But, what I'm having is:

$ rspec spec/policies/project_policy_spec.rb
F....F

Failures:

  1) ProjectPolicy show? blocks anonymous users
     Failure/Error: expect(subject).not_to permit(nil, project)
       Expected ProjectPolicy not to grant show? on #<Project:0x007fd0ea33b108> but show? was granted
     # ./spec/policies/project_policy_spec.rb:14:in `block (3 levels) in <top (required)>'

  2) ProjectPolicy show? doesn't allow users assigned to other projects
     Failure/Error: expect(subject).not_to permit(user, project)
       Expected ProjectPolicy not to grant show? on #<Project:0x007fd0e73a1f28> but show? was granted
     # ./spec/policies/project_policy_spec.rb:40:in `block (3 levels) in <top (required)>'

Finished in 0.06669 seconds (files took 1.33 seconds to load)
6 examples, 2 failures

Failed examples:

rspec ./spec/policies/project_policy_spec.rb:13 # ProjectPolicy show? blocks anonymous users
rspec ./spec/policies/project_policy_spec.rb:37 # ProjectPolicy show? doesn't allow users assigned to other projects
Askar (112) [Avatar] Offline
#2
Made branch from the last working commit and continue working.
Get back with the update once I find where I went wrong.
Askar (112) [Avatar] Offline
#3
Redoing exercises fixed the issue.