todo/backend/spec/utils/config_spec.cr

62 lines
1.5 KiB
Crystal

require "../spec_helper"
require "../../src/utils/config"
describe Config do
before_each {
Config.load_config
}
it "secret is present" do
secret = Config.get_config_value("secret")
secret.is_a?(JSON::Any).should be_true
if secret.is_a?(JSON::Any)
secret.as_s.empty?.should be_false
end
end
it "port is present" do
port = Config.get_config_value("port")
port.is_a?(JSON::Any).should be_true
if port.is_a?(JSON::Any)
port.as_i.is_a?(Int).should be_true
port.as_i.should_not eq(0)
end
end
it "database url is present" do
url = Config.get_config_value("db_url")
url.is_a?(JSON::Any).should be_true
if url.is_a?(JSON::Any)
url.as_s.empty?.should be_false
end
end
it "mail host and port are present" do
host = Config.get_config_value("mail_host")
host.is_a?(JSON::Any).should be_true
if host.is_a?(JSON::Any)
host.as_s.empty?.should be_false
end
port = Config.get_config_value("mail_port")
port.is_a?(JSON::Any).should be_true
if port.is_a?(JSON::Any)
port.as_i.is_a?(Int).should be_true
port.as_i.should_not eq(0)
end
end
it "mail username and password are present" do
uname = Config.get_config_value("mail_username")
uname.is_a?(JSON::Any).should be_true
if uname.is_a?(JSON::Any)
uname.as_s.empty?.should be_false
end
pword = Config.get_config_value("mail_password")
pword.is_a?(JSON::Any).should be_true
if pword.is_a?(JSON::Any)
pword.as_s.empty?.should be_false
end
end
end