-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Labels
Status: UntriagedAn issue that has yet to be triaged.An issue that has yet to be triaged.
Description
Version:
Artifactory gem version 3.0.17
Environment:
ruby 2.7.2 RHEL7 (but this bug seem agnostic to ruby/OS version)
Scenario:
Create a new object derived from Artifactory::Resource::Base that has some attributes defined (e.g. PermssionTarget), and modify that object's attribute values. When creating a new object of the same type, the default attribute values are now the same as the first object.
Steps to Reproduce:
Example rspec tests:
require 'rspec'
require 'artifactory'
describe Artifactory::Resource::PermissionTarget do
it 'does not modify default attribute principals' do
a = Artifactory::Resource::PermissionTarget.new
a.users['user_a'] = %w[read]
b = Artifactory::Resource::PermissionTarget.new
expect(b.users).to eq({})
end
it 'does not modify default attribute includes_pattern' do
a = Artifactory::Resource::PermissionTarget.new
tmp = a.includes_pattern
tmp.gsub!(/\*\*/, 'new_pattern')
b = Artifactory::Resource::PermissionTarget.new
expect(b.includes_pattern).to eq('**')
end
it 'does not modify default attribute excludes_pattern' do
a = Artifactory::Resource::PermissionTarget.new
tmp = a.excludes_pattern
tmp.replace 'new_pattern'
b = Artifactory::Resource::PermissionTarget.new
expect(b.excludes_pattern).to eq('')
end
endExpected Result:
I expect those rspec tests to pass.
Actual Result:
>rspec 'tests/artifactory_test.rb'
FFF
Failures:
1) Artifactory::Resource::PermissionTarget does not modify default attribute principals
Failure/Error: expect(b.users).to eq({})
expected: {}
got: {"user_a"=>["read"]}
(compared using ==)
Diff:
@@ -1 +1,2 @@
+"user_a" => ["read"],
# ./tests/artifactory_test.rb:12:in `block (2 levels) in <top (required)>'
2) Artifactory::Resource::PermissionTarget does not modify default attribute includes_pattern
Failure/Error: expect(b.includes_pattern).to eq('**')
expected: "**"
got: "new_pattern"
(compared using ==)
# ./tests/artifactory_test.rb:20:in `block (2 levels) in <top (required)>'
3) Artifactory::Resource::PermissionTarget does not modify default attribute excludes_pattern
Failure/Error: expect(b.excludes_pattern).to eq('')
expected: ""
got: "new_pattern"
(compared using ==)
# ./tests/artifactory_test.rb:28:in `block (2 levels) in <top (required)>'
Finished in 0.02337 seconds (files took 0.24672 seconds to load)
3 examples, 3 failures
Failed examples:
rspec ./tests/artifactory_test.rb:8 # Artifactory::Resource::PermissionTarget does not modify default attribute principals
rspec ./tests/artifactory_test.rb:15 # Artifactory::Resource::PermissionTarget does not modify default attribute includes_pattern
rspec ./tests/artifactory_test.rb:23 # Artifactory::Resource::PermissionTarget does not modify default attribute excludes_pattern
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Status: UntriagedAn issue that has yet to be triaged.An issue that has yet to be triaged.