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

fix admin fixture, use admin user, fix redirect #261

Merged

Conversation

pineappledreams
Copy link
Contributor

Issue

Fixes #218

Summary

  1. Implement require_admin check at app/controllers/admin/base_controller.rb
  2. When failed, it will redirect to root_url (tentative)
  3. test/fixtures/users.yml the admin user is now an actual admin
  4. Make admin tests actually use the admin-user.

@jim jim self-requested a review October 3, 2020 20:09
Copy link
Member

@jim jim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this one!

We've been trying to move away from fixtures and toward using FactoryBotyfactories instead. This wasn't documented anywhere, so there is no way you could have known.

In any case, if you can update the calls to users(:admin) to create(:admin_user), we should be able to merge this in.

@jim
Copy link
Member

jim commented Oct 3, 2020

Also, the test failure on this branch has been fixed on the development branch, so you can either merge that into this one or we can take care of it when it comes time to merge.

@pineappledreams
Copy link
Contributor Author

@jim gotcha bud, I will get right to it.

@pineappledreams
Copy link
Contributor Author

That's strange, I am running the docker-compose exec web rails test:system and rails test too on my computer but it won't get any errors. Am I missing something here?

@jim
Copy link
Member

jim commented Oct 4, 2020

@pineappledreams Everything is passing locally for me as well. It might be a CI issue, as we've been having some build instability on Circle recently. I'm going to merge this.

@jim jim self-requested a review October 4, 2020 14:08
Copy link
Member

@jim jim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making those revisions!

@jim jim merged commit 83daa95 into chicago-tool-library:development Oct 4, 2020
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

Successfully merging this pull request may close these issues.

Shouldn't be able to force your way into /admin
2 participants