2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00
discourse/spec/models/global_setting_spec.rb

23 lines
597 B
Ruby
Raw Normal View History

2013-12-20 16:17:21 +11:00
require 'spec_helper'
require 'tempfile'
describe GlobalSetting::FileProvider do
it "can parse a simple file" do
f = Tempfile.new('foo')
f.write(" # this is a comment\n")
f.write("\n")
f.write("a = 1000 # this is a comment\n")
f.write("b = \"10 # = 00\" # this is a # comment\n")
f.write("c = \'10 # = 00\' # this is a # comment\n")
f.close
provider = GlobalSetting::FileProvider.from(f.path)
provider.lookup(:a,"").should == 1000
provider.lookup(:b,"").should == "10 # = 00"
provider.lookup(:c,"").should == "10 # = 00"
f.unlink
end
end