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

Inconsistency in RSpec::Puppet::FunctionMatchers::Run's expected_result handling #266

Closed
DavidS opened this issue Apr 14, 2015 · 1 comment

Comments

@DavidS
Copy link
Collaborator

DavidS commented Apr 14, 2015

Please not the different error messages here:

  1) bool2str should run bool2str(true) and return true
     Failure/Error: it { is_expected.to run.with_params(true).and_return(true) }
       expected bool2str(true) to have returned true instead of "true"
  2) bool2str should run bool2str(false) and return false
     Failure/Error: it { is_expected.to run.with_params(false).and_return(false) }
       expected bool2str(false) to have run successfully

I would have expected the second spec to say "have returned false instead of "false"".

Turns out that RSpec::Puppet::FunctionMatchers::Run is testing if @expected_result at

if @expected_return
so it will misdetect that.

The simple solution of testing for !@expected_result.nil? will fail for the same reason, when nil itself is passed as a value. A separate @expected_result_set member would alleviate this.

@DavidS
Copy link
Collaborator Author

DavidS commented Jun 22, 2015

Fixed in 2.2.0

@DavidS DavidS closed this as completed Jun 22, 2015
openstack-gerrit pushed a commit to openstack-archive/fuel-library that referenced this issue Oct 23, 2015
This change includes an update to rspec-puppet ~> 2.2 and adjusting the
two tests that fail under 2.2 but not 2.1. I believe these failures are
related to rodjek/rspec-puppet#266

The get_network_role_properly was previously passing because the return
value was not be properly check. In the code we are returning eth0 as
the interface for the admin network role and not nil.

The get_transformation_property was previously passing because the
return value was not correctly checked. Based on the code, the value for
eth2 should have been 1024 while the value for eth3 would have been nil.
This change updates the eth2 check with 1024 and adds a test case for
eth3.

Change-Id: I7b87d02d4c702dde68ecd7f4abcd304e686fa795
Closes-Bug: #1509056
xenolog pushed a commit to xenolog/l23network that referenced this issue May 27, 2016
This change includes an update to rspec-puppet ~> 2.2 and adjusting the
two tests that fail under 2.2 but not 2.1. I believe these failures are
related to rodjek/rspec-puppet#266

The get_network_role_properly was previously passing because the return
value was not be properly check. In the code we are returning eth0 as
the interface for the admin network role and not nil.

The get_transformation_property was previously passing because the
return value was not correctly checked. Based on the code, the value for
eth2 should have been 1024 while the value for eth3 would have been nil.
This change updates the eth2 check with 1024 and adds a test case for
eth3.

FUEL-Change-Id: I7b87d02d4c702dde68ecd7f4abcd304e686fa795
FUEL-Closes-Bug: #1509056
xenolog pushed a commit to xenolog/l23network that referenced this issue May 27, 2016
This change includes an update to rspec-puppet ~> 2.2 and adjusting the
two tests that fail under 2.2 but not 2.1. I believe these failures are
related to rodjek/rspec-puppet#266

The get_network_role_properly was previously passing because the return
value was not be properly check. In the code we are returning eth0 as
the interface for the admin network role and not nil.

The get_transformation_property was previously passing because the
return value was not correctly checked. Based on the code, the value for
eth2 should have been 1024 while the value for eth3 would have been nil.
This change updates the eth2 check with 1024 and adds a test case for
eth3.

FUEL-Change-Id: I7b87d02d4c702dde68ecd7f4abcd304e686fa795
FUEL-Closes-Bug: #1509056

Close: #182
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant