-
Notifications
You must be signed in to change notification settings - Fork 58
View catalogue / homepage without login #175
Comments
Was: "Legit home / splash page?" We could perhaps allow non-logged in users to view the catalogue by implementing a special "dummy user", which would redirect to login if they tried to add anything to the cart etc, if we want to do this. Most online catalogues allow browsing before setting up an account. |
I like that approach - it would let us keep the catalog DRY. |
note:
|
Some notes after ~1 hr of work:
|
Ok, some more notes:
TO DO:
|
Turns out we forgot to add |
On second thought, we need to be moving away from CAS specifically (see #2) so any changes we make right now will be specific to our current authentication setup and will have to be changed after we implement something like Devise. We're going to start working on #2 and come back to this once that is finished. |
If we switch to Devise, they include guest user functionality! |
They could probably even put things in their cart before creating an account, that's a bonus feature! :D |
Yup that's what we were hoping for. We'll get back to this after #2 is finished. |
I've taken the first step of disabling authentication for the catalog controller in the |
Ok, most of this has been completed in #2. We should still review the behavior of the app for guests and also write some tests. We should also allow admins to configure if guest users are allowed. |
Ok, so I'm pretty sure that the guest functionality works as expected. In particular, guests can:
The navbar has a 'Sign In' link as does the cart. At this point, I think I'll write some integration tests to verify that our authorization is working as expected (e.g. can't visit |
Ok, these tests are mostly written, albeit dependent on a CSS |
Ok, so this is resolved except I'm having trouble testing the setting. For some reason, I can use a |
The functionality has been tested manually and the setting does what's expected (forces authentication on all requests if guest functionality is disabled). There is a potential issue with an error flash showing up after logging in w/ CAS under those circumstances, I can try to deal with it once we resolve the testing issues. |
This is incredibly frustrating; I tried splitting the tests into two describe blocks and the issue is still occurring. I'm going to try getting rid of the shared examples (unfortunately) and see if that helps. |
OOOOOOOOOOOOOOOOOOOK, I (edit: kinda) figured it out. Rails is caching something between requests in It appears as though this doesn't affect CanCan, since when the disabled context goes second, all of the failed tests are either visits to the homepage or redirects to the homepage from CanCan when trying to access a forbidden action (as set by our This is becoming a huge pain; the code works but we're somehow in a weird edge case where RSpec and Rails aren't playing nicely together. I'll give this a little more time and then just try to get this reviewed / merge as is (since it's working manually). |
Unfortunately, changing that setting breaks a whole bunch of tests (801 out of 1409, to be precise) :-( - I think it has something to do w/ threading. The error message is |
OMG I GOT IT! |
Sorry, that had to be on it's own comment. Wow. Ok, so I was using conditional before filters incorrectly and this resulted in class caching preventing later tests from checking the conditional. I largely figured it out from this SO thread, particularly this answer (when I was trying to implement a conditional Basically, rather than use Ruby conditionals to evaluate whether or not to run (or skip) a
becomes
Some similar hackery to deal with the generalized actions in |
Also, I learned about using the Rails logger which was super useful, see here. |
We should have a homepage with at least:
We might also want it to have:general info about the app / projectfeed of recently added models, or featured modelsgeneral dashboard layout.. :-D#2014/12/18
/reservations/new
, etc)The text was updated successfully, but these errors were encountered: