AritDevCircle / shiftwork2

Are you a shiftworker looking for last-minute gigs? Or a business owner with open shifts to fill? The Shiftwork app can connect you to shift opportunities or shiftworkers!
https://shiftworkapp.herokuapp.com
2 stars 4 forks source link

Tests For Shifts Controller #87

Closed Timilehin08 closed 3 years ago

Timilehin08 commented 3 years ago

What type of PR is this? (check all applicable)

Description of what PR does

Related PRs and/or Issues (if any)

-

QA Instructions, Screenshots, Recordings

Added tests?

Added to documentation?

Timilehin08 commented 3 years ago

Hello @msarit. I'm having an error pop up and this is why. for the redirect path, what the routes show me where it terminates, is different from what the shifts rb file says. I initially implemented what the route path says and the test still didn't pass. Same with when i used the path the shifts.rb file shows. I still had no luck on that. I'll really ike to know where i'm getting it wrong, as i got stuck.

Also I saw that PATCH and PUT are doing the same function of 'update' in the route, so i incorporated only the PATCH. Am i meant to test for the both of them regardless?

ncbui commented 3 years ago

Hello @msarit. I'm having an error pop up and this is why. for the redirect path, what the routes show me where it terminates, is different from what the shifts rb file says. I initially implemented what the route path says and the test still didn't pass. Same with when i used the path the shifts.rb file shows. I still had no luck on that. I'll really ike to know where i'm getting it wrong, as i got stuck.

Hey @Timilehin08 , I think I ran into something similar. Are you getting an error message like this?

Screen Shot 2021-05-12 at 4 39 38 AM

I was calling a controller action for group of resources (and new resources) when I wanted just a single resource. Changing 'workers_path' (collective controller action) to 'worker_path' (member controller action) fixed it.

Screen Shot 2021-05-12 at 4 40 06 AM
Timilehin08 commented 3 years ago

Yes @ncbui that’s the same error I had. I’ll try out what you did for shift path and see if it works. Thank you so much Cam!

msarit commented 3 years ago

Hello @Timilehin08! 👋🏾

So I decided to create some tutorials on how you can improve your tests.

The tutorial was long, so I divided it into 3 parts to be easier to manage bandwidth-wise 😅

Part 1 of 3: https://www.loom.com/share/23fd75a0a7b04865ae6da08599085338 Part 2 of 3: https://www.loom.com/share/100bd2556b0e4a5c949b33c1c9d84d71 Part 3 of 3: https://www.loom.com/share/780542d640af40c9a6524df7c8a0435a?sharedAppSource=personal_library

I also created a gist of all the code I wrote in the tutorial, so you have easy access for copy-paste needs ❤️

Gist: https://gist.github.com/msarit/adf9dcd8550df335d9e97e7b741616a1