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

Fix the RegistrationSystem spec #19806

Merged
merged 1 commit into from
Feb 4, 2020

Conversation

agrare
Copy link
Member

@agrare agrare commented Feb 4, 2020

AwesomeSpawn::CommandResultError expects an AwesomeSpawn::CommandResult
argument to #initailize not a string.

LinuxAdmin correctly passes the result to the exception: https://github.com/ManageIQ/linux_admin/blob/master/lib/linux_admin/registration_system/subscription_manager.rb#L8

This spec was stubbing the
LinuxAdmin::SubscriptionManager#organizations method and raising an
exception with a string instead of a CommandResult.

This was changed by ManageIQ/awesome_spawn#39 which was committed a while ago but only recently released.

AwesomeSpawn::CommandResultError expects an AwesomeSpawn::CommandResult
argument to `#initailize` not a string.

This spec was stubbing the
`LinuxAdmin::SubscriptionManager#organizations` method and raising an
exception with a string instead of a CommandResult.
@miq-bot
Copy link
Member

miq-bot commented Feb 4, 2020

Some comments on commit agrare@b8e02e3

spec/models/registration_system_spec.rb

  • ⚠️ - 41 - Detected expect_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.

@miq-bot
Copy link
Member

miq-bot commented Feb 4, 2020

Checked commit agrare@b8e02e3 with ruby 2.5.5, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 🍰

@Fryguy Fryguy merged commit 2e03a3b into ManageIQ:master Feb 4, 2020
@Fryguy Fryguy added this to the Sprint 130 Ending Feb 17, 2020 milestone Feb 4, 2020
@Fryguy Fryguy self-assigned this Feb 4, 2020
@@ -38,7 +38,7 @@
end

it "with invalid credentials" do
expect_any_instance_of(LinuxAdmin::SubscriptionManager).to receive(:organizations).once.and_raise(LinuxAdmin::CredentialError, "Invalid username or password")
expect_any_instance_of(LinuxAdmin::SubscriptionManager).to receive(:organizations).once.and_raise(LinuxAdmin::CredentialError, AwesomeSpawn::CommandResult.new("command_line", "Invalid username or password", "Invalid username or password", 1))
Copy link
Member

Choose a reason for hiding this comment

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

I think this output is only on stderr

@agrare agrare deleted the fix_registration_system_spec branch February 4, 2020 20:58
@kbrock kbrock mentioned this pull request Feb 4, 2020
simaishi pushed a commit that referenced this pull request Feb 4, 2020
Fix the RegistrationSystem spec

(cherry picked from commit 2e03a3b)
@simaishi
Copy link
Contributor

simaishi commented Feb 4, 2020

Hammer backport details:

$ git log -1
commit bd6453fce347d992ba8c368ad4030a366d35068f
Author: Jason Frey <[email protected]>
Date:   Tue Feb 4 15:56:20 2020 -0500

    Merge pull request #19806 from agrare/fix_registration_system_spec

    Fix the RegistrationSystem spec

    (cherry picked from commit 2e03a3b553ed20a31a31518c5ea100cdfbd8a41d)

simaishi pushed a commit that referenced this pull request Feb 6, 2020
Fix the RegistrationSystem spec

(cherry picked from commit 2e03a3b)
@simaishi
Copy link
Contributor

simaishi commented Feb 6, 2020

Ivanchuk backport details:

$ git log -1
commit 10a2f52c6bf1da224ce5098096e665d1b2df2a86
Author: Jason Frey <[email protected]>
Date:   Tue Feb 4 15:56:20 2020 -0500

    Merge pull request #19806 from agrare/fix_registration_system_spec

    Fix the RegistrationSystem spec

    (cherry picked from commit 2e03a3b553ed20a31a31518c5ea100cdfbd8a41d)

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.

5 participants