-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure all table names originate from Lhm::TableName #49
Conversation
Because the table name behavior was distributed all over the system, it was not under test. This commit consolidates this behavior and puts it under test.
As you can see, the logic for describing table names is all over the place. Trying to change the interfaces for these classes is beyond the scope of the PR, as these interfaces are sadly coupled to the test suite. However, we can at least have these classes delegate the logic for these table names to something is well tested and centralized. This eliminates the tests currently running on migration_spec.
This solves our primary problem. It doesn't change the length of the timestamp, because #50, but at this point, we shouldn't care about that. |
end | ||
|
||
def archive_name | ||
"lhma_#{ startstamp }_#{ @origin.name }"[0...64] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That‘s 65, not 64 bytes, I think?
|
||
attr_reader :original | ||
|
||
def archived |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure whether you end up with 65 instead of 64 bytes in all of these cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but if that's the case, how does the test pass? I'm confused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@berlincount With three dots, ranges in Ruby are not inclusive:
irb(main):013:0> 'asdasdasdasdasdasdasdasdasdasdasdasdasdasdadasdasdasdasdasdasdasdasdasdadasd'[0...64].length
=> 64
With two dots they are. It's not my favourite syntax 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what. the. beep.
Ruby magic strikes again.
As you can see, the logic for describing table names is all over the place.
Trying to change the interfaces for these classes is beyond the scope of
the PR, as these interfaces are sadly coupled to the test suite.
However, we can at least have these classes delegate the logic for these
table names to something is well tested and centralized. This eliminates
the tests currently running on migration_spec.
Closes #47