chef / chef-vault-testfixtures

provides an RSpec shared context for testing Chef cookbooks that use chef-vault
Apache License 2.0
7 stars 10 forks source link

databag items fail on camel-case names #21

Open viebrock opened 8 years ago

viebrock commented 8 years ago

Hi,

I found that:

  1. using this line in the recipe: item = chef_vault_item('foo', 'Bar')
  2. specifying a databag name of "Bar.json" under test/integration/data_bags/foo

results in the following error. switching to all lower-case magically fixes it. thanks.

-Dave

Failures:

 Failure/Error: let(:chef_run) { ChefSpec::SoloRunner.new.converge(described_recipe) }
   #<ChefVault::Item (class)> received :vault? with unexpected arguments
     expected: (:foo, "bar")
          got: ("foo", "Bar")
   Diff:
   @@ -1,2 +1,2 @@
   -[:foo, "bar"]
   +["foo", "Bar"]

    Please stub a default value first if message might be received with other args as well.
rajiv-g commented 5 years ago

Not only for camel-case names. It fails even for item which has uppercase.

michaelPf85 commented 5 years ago

As far as I can tell it comes from there : https://github.com/chef/chef-vault-testfixtures/blob/master/lib/chef-vault/test_fixtures.rb#L67

The item is "lower-cased", I supposed it was to avoid problems when the extension isn't lowercase. But the regex seem to already be lowercase. I'll try to provide a test case and a fix for that, I lost a good hour to this.