HomePhorge

(maint) Rename let `example` instance variable
7bad5e7d25caUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(maint) Rename let example instance variable

Previously, the test created an instance variable named example, for
which rspec created a method that memoized the instance variable. The
method shadowed the example method on RSpec::Core::ExampleGroup, which
can lead to surprising results. For example if you add an rspec before
hook:

RSpec.configure do |config|
  config.before :each do |test|
    ...
  end
end

Then test will be derived from RSpec::Core::ExampleGroup:

(rdb:1) test.is_a? RSpec::Core::ExampleGroup
true

But if you call test.example it will return the memoized variable,
instead of the RSpec::Core::Example:

(rdb:2) test.example.class
Puppet::Type::Ssh_authorized_key

This commit simply renames the instance variable/method.

Details

Provenance
Josh Cooper <josh@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPUbfd66bc636dd: Merge remote-tracking branch 'upstream/stable'
Branches
Unknown
Tags
Unknown

Event Timeline

Josh Cooper <josh@puppetlabs.com> committed rPU7bad5e7d25ca: (maint) Rename let `example` instance variable (authored by Josh Cooper <josh@puppetlabs.com>).Jan 21 2015, 6:21 AM