diff --git a/spec/chef/helper_spec.rb b/spec/chef/helper_spec.rb index 22bca5b..d1f4eb7 100644 --- a/spec/chef/helper_spec.rb +++ b/spec/chef/helper_spec.rb @@ -4,6 +4,7 @@ RSpec.describe ChefVault::Mixin::Helper do include ChefVault::Mixin::Helper + let(:json) { { "username": "root" } } let(:json_data) { '{"username": "root", "password": "abcabc"}' } let(:buggy_json_data) { '{"username": "root", "password": "abc\abc"' } @@ -15,5 +16,12 @@ it "Not to raise error if valid data provided" do expect { validate_json(json_data) }.to_not raise_error end + + it "not to raise error if data consist of tab/new line OR space" do + %w{abc\tabc abc\nabc}.each do |pass| + json_data_with_slash = json.merge("password": pass) + expect { validate_json(json_data_with_slash.to_s) }.to_not raise_error + end + end end end \ No newline at end of file