Skip to content

Commit

Permalink
Removed store validation
Browse files Browse the repository at this point in the history
Signed-off-by: piyushawasthi <[email protected]>
  • Loading branch information
piyushawasthi committed Jul 13, 2018
1 parent f1349c4 commit bc5217e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions lib/win32/certstore/mixin/assertions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ module Mixin
module Assertions
# Validate certificate store name
def validate_store(store_name)
unless valid_store_name.include?(store_name.to_s.upcase)
raise ArgumentError, "Invalid Certificate Store."
if store_name.to_s.strip.empty?
raise ArgumentError, "Empty Certificate Store."
end
end

Expand Down
12 changes: 6 additions & 6 deletions spec/win32/unit/certstore_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@
context "When passing empty certificate store name" do
let(:store_name) { "" }
it "raises ArgumentError" do
expect { certstore.open(store_name) }.to raise_error(ArgumentError, "Invalid Certificate Store.")
expect { certstore.open(store_name) }.to raise_error(ArgumentError, "Empty Certificate Store.")
end
end

context "When passing invalid certificate store name" do
let(:store_name) { "Chef" }
it "raises ArgumentError" do
expect { certstore.open(store_name) }.to raise_error(ArgumentError, "Invalid Certificate Store.")
expect { certstore.open(store_name) }.not_to raise_error(ArgumentError, "Empty Certificate Store.")
end
end

context "When passing nil certificate store name" do
let(:store_name) { nil }
it "raises ArgumentError" do
expect { certstore.open(store_name) }.to raise_error(ArgumentError, "Invalid Certificate Store.")
expect { certstore.open(store_name) }.to raise_error(ArgumentError, "Empty Certificate Store.")
end
end

Expand Down Expand Up @@ -102,7 +102,7 @@
context "When passing empty certificate store name" do
let(:store_name) { "" }
it "raises ArgumentError" do
expect { certstore.open(store_name) }.to raise_error(ArgumentError, "Invalid Certificate Store.")
expect { certstore.open(store_name) }.to raise_error(ArgumentError, "Empty Certificate Store.")
end
end

Expand Down Expand Up @@ -190,7 +190,7 @@
context "When passing empty certificate store name" do
let(:store_name) { "" }
it "raises ArgumentError" do
expect { certstore.open(store_name) }.to raise_error(ArgumentError, "Invalid Certificate Store.")
expect { certstore.open(store_name) }.to raise_error(ArgumentError, "Empty Certificate Store.")
end
end

Expand Down Expand Up @@ -272,7 +272,7 @@
context "When passing empty certificate store name" do
let(:store_name) { "" }
it "raises ArgumentError" do
expect { certstore.open(store_name) }.to raise_error(ArgumentError, "Invalid Certificate Store.")
expect { certstore.open(store_name) }.to raise_error(ArgumentError, "Empty Certificate Store.")
end
end

Expand Down
6 changes: 3 additions & 3 deletions spec/win32/unit/store/assertions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@ class Store
context "When passing empty certificate store name" do
let(:store_name) { "" }
it "raises ArgumentError" do
expect { certstore.validate_store(store_name) }.to raise_error("Invalid Certificate Store.")
expect { certstore.validate_store(store_name) }.to raise_error("Empty Certificate Store.")
end
end

context "When passing invalid certificate store name" do
let(:store_name) { "Chef" }
it "raises ArgumentError" do
expect { certstore.validate_store(store_name) }.to raise_error("Invalid Certificate Store.")
expect { certstore.validate_store(store_name) }.to raise_error("Empty Certificate Store.")
end
end

context "When passing empty certificate store name" do
let(:store_name) { nil }
it "raises ArgumentError" do
expect { certstore.validate_store(store_name) }.to raise_error("Invalid Certificate Store.")
expect { certstore.validate_store(store_name) }.to raise_error("Empty Certificate Store.")
end
end

Expand Down

0 comments on commit bc5217e

Please sign in to comment.