Skip to content
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

Add a STI disabled spec #245

Merged
merged 2 commits into from
Aug 9, 2018
Merged

Conversation

bdunne
Copy link
Member

@bdunne bdunne commented Aug 8, 2018

Adding this as an automated code review to address #4 (comment)

Also fixing the current failures

@Fryguy
Copy link
Member

Fryguy commented Aug 8, 2018

So, one issue I see is that this uses the current schema to check "old" migrations, which is invalid. You need to use the schema at the time of the migration to determine if the inheritance disablement is necessary.

Copy link
Member

@Fryguy Fryguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️

@bdunne bdunne force-pushed the type_disabled_spec branch from efafe43 to ed03d47 Compare August 8, 2018 22:02
@bdunne
Copy link
Member Author

bdunne commented Aug 8, 2018

@Fryguy Updated, please take a look

@@ -15,6 +15,19 @@ def migration_context(direction, &block)

it("with empty tables") { migrate }

it "STI is disabled for all involved ActiveRecord::Base descendants" do
classes = ActiveRecord::Base.descendants.select { |klass| klass.namespace.first == described_class.to_s }.compact
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to flip this around to something like

described_class.constants.select { |c| c < ActiveRecord::Base }

@bdunne bdunne force-pushed the type_disabled_spec branch from ed03d47 to f69f8b6 Compare August 9, 2018 15:44
@miq-bot
Copy link
Member

miq-bot commented Aug 9, 2018

Checked commits bdunne/manageiq-schema@8aaeae5~...f69f8b6 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
10 files checked, 0 offenses detected
Everything looks fine. 🍪

@Fryguy Fryguy merged commit 5133829 into ManageIQ:master Aug 9, 2018
@Fryguy Fryguy added this to the Sprint 92 Ending Aug 13, 2018 milestone Aug 9, 2018
@bdunne bdunne deleted the type_disabled_spec branch August 9, 2018 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants