summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/unit/data_bag_item_spec.rb8
-rw-r--r--spec/unit/data_bag_spec.rb6
2 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/data_bag_item_spec.rb b/spec/unit/data_bag_item_spec.rb
index 6bc5954fa5..4f017ebb60 100644
--- a/spec/unit/data_bag_item_spec.rb
+++ b/spec/unit/data_bag_item_spec.rb
@@ -70,6 +70,14 @@ describe Chef::DataBagItem do
lambda { @data_bag_item.raw_data = { "id" => "h1-_" } }.should_not raise_error(ArgumentError)
end
+ it "should accept alphanum.alphanum for the id" do
+ lambda { @data_bag_item.raw_data = { "id" => "foo.bar" } }.should_not raise_error(ArgumentError)
+ end
+
+ it "should accept .alphanum for the id" do
+ lambda { @data_bag_item.raw_data = { "id" => ".bozo" } }.should_not raise_error(ArgumentError)
+ end
+
it "should raise an exception if the id contains anything but alphanum/-/_" do
lambda { @data_bag_item.raw_data = { "id" => "!@#" } }.should raise_error(ArgumentError)
end
diff --git a/spec/unit/data_bag_spec.rb b/spec/unit/data_bag_spec.rb
index 9fbdc64d98..8c9465caf7 100644
--- a/spec/unit/data_bag_spec.rb
+++ b/spec/unit/data_bag_spec.rb
@@ -47,6 +47,12 @@ describe Chef::DataBag do
it "should throw an ArgumentError if you feed it anything but a string" do
lambda { @data_bag.name Hash.new }.should raise_error(ArgumentError)
end
+
+ [ ".", "-", "_", "1"].each do |char|
+ it "should allow a '#{char}' character in the data bag name" do
+ @data_bag.name("clown#{char}clown").should == "clown#{char}clown"
+ end
+ end
end
describe "deserialize" do