Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
That’s impossible! You’d have to literally connect to a different db with a table missing that column! Did they forget to hide db details? Concerns separation 101. I’m actually amazed that this ugly complex codebase is out there running in production, being used by customers lol.
-
Root797673y@TeachMeCode That would be the logical explanation, but that doesn’t apply here.
Perhaps it’s trying to build an object from a different model be a use of indirection, or something is triggering code to write to dynamic or encrypted columns that may not have handlers in the given context, or some parent spec was enabling specific configuration that allowed it, or … 🤷🏻♀️
The codebase is convoluted and awful, and I’ve given up trying to understand why because the answer is always stupidity combined with haste or laziness and mounting technical debt. -
cprn17623yWait. What? Why does spec complain about database structure? I mean, shouldn't all external bits in specs be mocked? Unless you're working on the next version of MySQL engine this codebase reeks of issues no amount of boss-explaining can justify.
-
Root797673y@cprn
FactoryBot.create(:system_user, email: …, password: …, roles: …) is what’s throwing the error. That creates the required record(s) and writes them to the db. Makes sense that it can throw MySQL errors for missing columns, but it doesn’t make sense that it works fine in some specs but not others. -
Root797673y@AvatarOfKaine Payments company sitting between businesses and end customers, other businesses, casinos, etc.
With a plethora of settings, environments, configurations, integrations, etc. -
@Root so something that should be simpler if not simple but dragged in a bunch of other peoples code and external systems ?
-
@Root wow...if those are why it’s giving the error Im even more amazed that this is being used by customers. I’m impressed that they made it this far with such horrible spaghetti vomit code. They probably have better scamming or marketing skills to compensate for their low aptitude for software dev...
-
cprn17623y@Root Maybe we're talking about different things? Specs are given-when-then unit tests, right? I see no reason to test whether you can make a database insert or not unless you're testing the database engine itself so I assume your spec requires a valid user to test something else (i.e. you create a user in the `when` step). If that's the case IMHO you should mock a user object so it'd be valid even when there's no database at all. And if that's not possible or too much of a hassle then it's the question of that codebase being too closely coupled and, as a result, not testable - this is why I said it probably has bigger issues. Unless `spec` in your world means something entirely different, which it totally can - I only know specs from `rspec` and `phpspec`.
-
Root797673y@cprn No, I’m not testing db writes.
The (test) database is empty before running specs, and the login specs naturally require a user in order to test login, so I’m creating the user before running that set of specs. (That’s what FactoryBot does: build or create (build+save) objects from factories.)
The issue is that the line creating the user fails, despite the same line working elsewhere. I outlined some possibilities as to why, and also why I’ve more or less given up trying to figure things like this out. It’s basically never worth the effort. -
@Root I think I have an idea what that company is, I won’t reveal for privacy. But count me out of working there. I would be scared to say a damn thing bc they might use a creative spin and call what I said -ist or they would lash out if it’s a good suggestion they never thought of lol. Used to think that the codebase would at least be the best part of that monkey cage but hot damn you can’t even do the simplest thing without a million other things breaking bc separation of concerns is not their “concern”
-
Root797673y@TeachMeCode The initials are three letters, ends with M. And yes, they’re very woke. I absolutely loathe it.
Related Rants
So;dfjkhijasdfkjq;sdfhjkl;asdf
I copy a line from one spec (to create a user) and paste it in another spec. It works just dandy in the first, and throws MySQL missing column errors in the other.
Fucking what.
This codebase is full of shit like this. Things work in one place but not another, and it’s never obvious why. Tens of thousands of gotchas and quirks. The only way I can get an answer to things like these is to either beg my boss for an explanation, which I’m sure he’s long since tired of, or spend a full day (or more) wading through several rabbit holes filled with raw sewage.
I wasted two hours today trying to get a simple fucking factory to work. And you know what? I just gave up and used the existing admin user. Yeah it’s a bad idea, but it’s fucking good enough.
They can yell if they want.
I have no cares left.
rant
non-deterministic
this train went off the rails long ago
so done
so tired
trainwreck
idc
puffing billy