Skip to content

Commit

Permalink
Merge pull request #191 from bdunne/nil_update_repo_name
Browse files Browse the repository at this point in the history
Nil MiqDatabase#update_repo_name
  • Loading branch information
Fryguy authored Apr 27, 2018
2 parents 6e614d4 + 35c75c0 commit 6182bd0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class SettingsChange < ActiveRecord::Base

def up
db = MiqDatabase.first
return unless db && my_region
return unless db.try(:update_repo_name) && my_region

say_with_time("Moving repo information from miq_databases to Settings") do
repos = db.update_repo_name.split
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@
).first
expect(setting_change.value).to eq(repo_list)
end

it "handles nil update_repo_name" do
database_attrs = {
:session_secret_token => SecureRandom.hex(64),
:csrf_secret_token => SecureRandom.hex(64),
}
database_stub.create!(database_attrs)

migrate

setting_change = settings_stub.where(
:key => described_class::SETTING_KEY,
:resource_id => region.id,
:resource_type => "MiqRegion"
)
expect(setting_change.count).to eq(0)
end
end

migration_context :down do
Expand Down

0 comments on commit 6182bd0

Please sign in to comment.