Update RSpec's Syntax

Bug #1816857 reported by Sofia Enriquez
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
puppet-cinder
Invalid
Medium
Soledad Kuczala

Bug Description

The primary syntax provided by RSpec-expectations is based on the expect method, which explicitly wraps an object or block of code to set an expectation on it.

Currently, the Puppet's cinder-modules use deprecated syntax. [1]

The should-based syntax, which relies upon should being monkey-patched onto every object in the system. However, this syntax can at times lead to some surprising failures, since RSpec does not own every object in the system and cannot guarantee that it will always work consistently. A deprecation warning will be issued if you do not explicitly enable it. [2]

That being said, It's recommended to use the expect syntax instead of the should syntax.[3] We need to update all the cinder-modules to use the primary syntax. [4]

To upgrade to the expect, we can apply transpec[5], which can perform the conversion automatically for us.

[1] https://github.com/openstack/puppet-cinder/blob/master/spec/classes/cinder_nova_spec.rb#L7
[2] https://relishapp.com/rspec/rspec-expectations/v/3-4/docs/syntax-configuration#disable-should-syntax
[3] http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
[4] https://github.com/openstack/puppet-cinder/tree/master/spec/classes
[5] https://github.com/yujinakayama/transpec

Changed in puppet-cinder:
assignee: nobody → Sofia Enriquez (lsofia-enriquez)
Soledad Kuczala (solkz)
Changed in puppet-cinder:
assignee: Sofia Enriquez (lsofia-enriquez) → Soledad Kuczala (solkz)
status: New → In Progress
Changed in puppet-cinder:
status: In Progress → New
Changed in puppet-cinder:
status: New → Confirmed
Revision history for this message
Alex Schultz (alex-schultz) wrote :

Sofia, missed your IRC question about bundler. The docs for setting up an env for testing can be found @ https://docs.openstack.org/puppet-openstack-guide/latest/contributor/testing.html

Changed in puppet-cinder:
importance: Undecided → Medium
Revision history for this message
Soledad Kuczala (solkz) wrote :

Thanks Alex, I'm on it.

Changed in puppet-cinder:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to puppet-cinder (master)

Reviewed: https://review.openstack.org/640863
Committed: https://git.openstack.org/cgit/openstack/puppet-cinder/commit/?id=c09a93456eb806f0cdb6e858470334413ac61ea6
Submitter: Zuul
Branch: master

commit c09a93456eb806f0cdb6e858470334413ac61ea6
Author: SolKuczala <email address hidden>
Date: Mon Mar 4 20:08:44 2019 +0000

    Modified archives from spec/classes with transpec tool

    Translated RSpec's Syntax deprecated from ruby archives in
    Puppet-Cinder/spec/classes.
    -Upgrade from RSpec 2 to RSpec 3 on corresponding files.
    Partial-Bug: #1816857

    Change-Id: I75cd0f348465c91500a8d3b8cd82ab53b3224c04

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to puppet-cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/642135

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to puppet-cinder (master)

Reviewed: https://review.openstack.org/642135
Committed: https://git.openstack.org/cgit/openstack/puppet-cinder/commit/?id=ae0c571a525e22f3ba891c3157093ccda666e642
Submitter: Zuul
Branch: master

commit ae0c571a525e22f3ba891c3157093ccda666e642
Author: SolKuczala <email address hidden>
Date: Fri Mar 8 20:00:08 2019 +0000

    Convert specs to RSpec 3.8.0 syntax with Transpec

    This conversion is done by Transpec 3.4.0
    This patch complements c09a93456eb806f0cdb6e858470334413ac61ea6
    adding all files inside defines/ dir.

    Partial-Bug: #1816857
    Change-Id: Ic00f8b38c5b84ff19fc945512f4f13aa11221c8b

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to puppet-cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/642889

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on puppet-cinder (master)

Change abandoned by Soledad Kuczala (<email address hidden>) on branch: master
Review: https://review.openstack.org/642889

Soledad Kuczala (solkz)
Changed in puppet-cinder:
status: In Progress → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.