Sha256: 69aec36dcd405a5947d47ebd6d69079bd99ebc4b035c665d2a353d08e2deb625
Contents?: true
Size: 1.01 KB
Versions: 18
Compression:
Stored size: 1.01 KB
Contents
require "spec_helper" describe Ruboty::Env::Validatable do let(:validatable_class) do Class.new do include Ruboty::Env::Validatable env :A, "description of A" env :B, "description of B", optional: true end end let(:instance) do validatable_class.new end describe "#validate" do context "without required ENV" do it "raises Ruboty::Env::ValidationError" do expect { instance.validate }.to raise_error(Ruboty::Env::ValidationError) end end context "without optional ENV" do before do ENV["A"] = "dummy" end after do ENV["A"] = nil end it "does nothing" do expect { instance.validate }.not_to raise_error end end end describe "#validate!" do context "without required ENV" do it "dies with usage as erorr message" do Ruboty.logger.should_receive(:error).with(/description of A/) Ruboty.should_receive(:exit) instance.validate! end end end end
Version data entries
18 entries across 18 versions & 1 rubygems