Skip to content

Commit

Permalink
[rails6][git_repository_spec.rb] Use .local_miq_server
Browse files Browse the repository at this point in the history
In Rails 6, it seems like a validation callback for nested relations is
causing a `GitRepository.save!` to fail.  In this case, a MiqQueue call
validation that checks that the `Zone` that is being provided via the
`options` to queue the work on actually exists.

This seems to have not been respected properly in the past, so this fix
just simply switches to using actually `MiqServer`/`Zone` records
instead of trying to stub them out.

Works in both Rails 5.2 and Rails 6.0
  • Loading branch information
NickLaMuro committed Nov 9, 2020
1 parent 88c2db4 commit 0aff5f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spec/models/git_repository_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
end

before do
allow(MiqServer).to receive(:my_zone).and_return("default")
EvmSpecHelper.local_miq_server
allow(gwt).to receive(:branches).with(anything).and_return(branch_list)
allow(gwt).to receive(:tags).with(no_args).and_return(tag_list)
allow(gwt).to receive(:branch_info) do |name|
Expand Down

0 comments on commit 0aff5f2

Please sign in to comment.