RiotGamesCookbooks / artifact-cookbook

Provides your cookbooks with the Artifact Deploy LWRP
Other
134 stars 91 forks source link

Messy ChefSpec tests with artifacts (previos definition of ... was here) #165

Open joerg opened 9 years ago

joerg commented 9 years ago

When testing any recipes/cookbook with ChefSpec that uses artifacts there are a lot of warnings about "previous definition of ... was here":

./tmp/chef/cache/cookbooks/artifact/libraries/chef_artifact.rb:3: warning: already initialized constant Chef::Artifact::DATA_BAG
/tmp/chef/cache/cookbooks/artifact/libraries/chef_artifact.rb:3: warning: previous definition of DATA_BAG was here
/tmp/chef/cache/cookbooks/artifact/libraries/chef_artifact.rb:4: warning: already initialized constant Chef::Artifact::WILDCARD_DATABAG_ITEM
/tmp/chef/cache/cookbooks/artifact/libraries/chef_artifact.rb:4: warning: previous definition of WILDCARD_DATABAG_ITEM was here
/tmp/chef/cache/cookbooks/artifact/libraries/chef_artifact.rb:5: warning: already initialized constant Chef::Artifact::DATA_BAG_NEXUS
/tmp/chef/cache/cookbooks/artifact/libraries/chef_artifact.rb:5: warning: previous definition of DATA_BAG_NEXUS was here
/tmp/chef/cache/cookbooks/artifact/libraries/chef_artifact.rb:6: warning: already initialized constant Chef::Artifact::DATA_BAG_AWS
/tmp/chef/cache/cookbooks/artifact/libraries/chef_artifact.rb:6: warning: previous definition of DATA_BAG_AWS was here

For me these warnings fill about 3 to 4 screens for each run.

This could easily be fixed with rubys OrEquals operator:

    DATA_BAG ||= "artifact"
    WILDCARD_DATABAG_ITEM ||= "_wildcard"
    DATA_BAG_NEXUS ||= 'nexus'
    DATA_BAG_AWS ||= 'aws'
maoueh commented 9 years ago

Fixed by #164.