Sha256: 45cd422653442fd593134998326e717efdbd73680c38ee95ef9c2eb5a952cd6d
Contents?: true
Size: 1.39 KB
Versions: 49
Compression:
Stored size: 1.39 KB
Contents
require 'spec_helper' module Marty describe Marty::Config do describe "validations" do it "should return valid config value based on key" do Marty::Config["TEST 1"] = 2 expect(Marty::Config.lookup("TEST 1")).to eq(2) expect(Marty::Config["TEST 1"]).to eq(2) end def testval(val) Marty::Config["testval"] = val expect(Marty::Config.lookup("testval")).to eq(val) expect(Marty::Config["testval"]).to eq(val) end it "should handle various structures correctly" do testval("[1,2,3]") testval("[1,\"2,3\"]") testval([1,2,3]) testval([1,"2,3"]) testval({ "key1" => [1,2,3], "keystr" => { "val" => "val"}}) testval(%Q({ "key1" : [1,2,3], "keystr" : { "val" : "val"}})) testval("123456.1234") testval("a string") testval("\"a string\"") end it "should return nil config value for non-existing key" do expect(Marty::Config.lookup("TEST 2")).to eq(nil) expect(Marty::Config["TEST 2"]).to eq(nil) end it "should handle del" do (0..10).each { |i| v = {"i" => i} Marty::Config["k#{i}"] = v expect(Marty::Config["k#{i}"]).to eq(v) } (0..10).each { |i| Marty::Config.del("k#{i}") expect(Marty::Config["k#{i}"]).to eq(nil) } end end end end
Version data entries
49 entries across 49 versions & 1 rubygems