Closed mediafinger closed 10 years ago
i can't even fix the sign_up! AHHHHHHGGHGHGH
OK, I think partly I just need to relax about this. tomorrow I will try to make sure that everything I have done in the last three days is working properly (eg the @location.id) and take your advice. I don't really know where to start with the tests. I tried writing some User ones and got a bit dispirited when they didn't work, then I realised that devise was handling most of it so there was no point testing the Users...
Yeah, I guess you should call it a day and relax. Tomorrow you will fix the issues with ease :grinning:
Now that you have your relations fixed, I suggest to write some tests for your bike model - and ensure that accessing the attributes of not only the bike, but also it's owner, location and reservations works as expected. Ensure that all necessary attributes and connections exist - and the missing optional ones don't cause failures.
before do
@user = User.create(...)
@location = Location.create(... user_id: @user.id)
end
it "should add the bike to the user" do
bike = Bike.create(... user_id: @user_id)
expect(bike.user).to eq @user
end
...
expect(bike.location).to eq @location
...
expect(bike.reservations.last).to eq @reservation
...
Ones you have proven that your models work as expected, you should try to write a controller spec that ensures that your bike #index action returns the expected list of @bicycles, that #edit is only accessible for the owner, that #create handles errors...
But that is all stuff for tomorrow! :sunrise: Enjoy your well deserved rest!
:wink:
I mean, it is great how much you did in the last 3 days! :clap:
But now is a good time to clean up. Fix what is broken, test you app manually - or even better take your time to write some tests, tidy the code and add a comment or two when you think they might help your future self.
And when you did that it is time for more cool features: