-1

I'm super confused. I think I'm encountering some kind of bug. Could use some help. I had passing specs (passed dozens of times on local and CI server), and these were completely unrelated to serializers. Like they _just check the status of certain controller methods. But then I literally ONLY added the active_model_serializers, a UserSerializer class, and now my specs are failing. It's saying the response from my controllers is :unauthorized which isn't even possible, b/c I'm calling render status: :created.

The entire app is OSS. This is literally all that has changed: https://github.com/codeblooded/atc-api/commit/a75978a9d9a65a5e8b592685a53045e9fe6d1d91 and it's claiming that this line https://github.com/codeblooded/atc-api/blob/master/app/controllers/colors_controller.rb#L12 is a 401. Any ideas? I'm about to remove active_model_serializers and see if my tests pass again.

See my answer below. I did remove the gem, and all the unrelated tests started passing again. So, I opened a bug with the project. I think active_model_serializers must be touching some object in some unexpected way.

Ben Reed
  • 824
  • 1
  • 8
  • 26
  • Without knowing stuff like what the test actually does it's hard to help, I think. – Dave Newton Jul 27 '17 at 17:41
  • @DaveNewton It just expects the http_status_code to be :created on a post request. https://github.com/codeblooded/atc-api/blob/weird-rspec-behavior/spec/controllers/traditions_controller_spec.rb#L23 and the code it tests: https://github.com/codeblooded/atc-api/blob/weird-rspec-behavior/app/controllers/traditions_controller.rb#L12 -- notice `:unauthorized` isn't even possible to be rendered here – Ben Reed Jul 27 '17 at 17:46

1 Answers1

0

Ok, so I'm pretty sure this is one of those weird bugs. I removed active_model_serializers gem and deleted my UserSerializer class. All tests pass again. I filed an issue with the project: active_model_serializers#2168.

Ben Reed
  • 824
  • 1
  • 8
  • 26