Jira (PUP-9913) described_class.has_feature leaks global state

8 views
Skip to first unread message

Josh Cooper (JIRA)

unread,
Jul 23, 2019, 6:36:02 PM7/23/19
to puppe...@googlegroups.com
Josh Cooper created an issue
 
Puppet / Task PUP-9913
described_class.has_feature leaks global state
Issue Type: Task Task
Assignee: Unassigned
Created: 2019/07/23 3:35 PM
Priority: Normal Normal
Reporter: Josh Cooper

Some rspec tests stub provider features by calling:

described_class.has_feature :libuser

However that modifies the global provider class, which metaprograms provider feature methods, such as:

Puppet::Provider::User::UseraddProvider.libuser?
Puppet::Provider::User::UseraddProvider#feature?(:libuser)

The tests should be updated to stub the provider class and instance instead, such as

allow(described_class).to receive(:libuser?).and_return(true)

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Josh Cooper (JIRA)

unread,
Jul 25, 2019, 12:44:02 PM7/25/19
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages