Skip to content

Commit

Permalink
Merge pull request #36 from MsysTechnologiesllc/piyush/remove_validat…
Browse files Browse the repository at this point in the history
…e_store

MSYS-856 : Removed store validation
  • Loading branch information
tas50 authored Jul 18, 2018
2 parents ab6179a + c32a778 commit fa0174a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 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
10 changes: 5 additions & 5 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
context "When passing new certificate store name" do
let(:store_name) { "Chef" }
it "raises ArgumentError" do
expect { certstore.validate_store(store_name) }.to raise_error("Invalid Certificate Store.")
it "not raises ArgumentError" do
expect { certstore.validate_store(store_name) }.not_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 fa0174a

Please sign in to comment.