Load data store keys as symbols, not strings.
This commit is contained in:
parent
52e3c4d3b3
commit
a84ea6a5b8
|
@ -13,7 +13,7 @@ module Vagrant
|
||||||
return if !file_path
|
return if !file_path
|
||||||
|
|
||||||
File.open(file_path, "r") do |f|
|
File.open(file_path, "r") do |f|
|
||||||
merge!(JSON.parse(f.read))
|
merge!(JSON.parse(f.read, :symbolize_names => true))
|
||||||
end
|
end
|
||||||
rescue Errno::ENOENT
|
rescue Errno::ENOENT
|
||||||
clear
|
clear
|
||||||
|
|
|
@ -19,19 +19,19 @@ class DataStoreTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "read the data" do
|
should "read the data" do
|
||||||
assert_equal @initial_data["foo"], @instance["foo"]
|
assert_equal @initial_data[:foo], @instance["foo"]
|
||||||
end
|
end
|
||||||
|
|
||||||
should "write the data, but not save it right away" do
|
should "write the data, but not save it right away" do
|
||||||
@instance["foo"] = "changed"
|
@instance[:foo] = "changed"
|
||||||
assert_equal "changed", @instance["foo"]
|
assert_equal "changed", @instance[:foo]
|
||||||
assert_equal @initial_data["foo"], @klass.new(@db_file)["foo"]
|
assert_equal @initial_data[:foo], @klass.new(@db_file)["foo"]
|
||||||
end
|
end
|
||||||
|
|
||||||
should "write the data if commit is called" do
|
should "write the data if commit is called" do
|
||||||
@instance["foo"] = "changed"
|
@instance[:foo] = "changed"
|
||||||
@instance.commit
|
@instance.commit
|
||||||
|
|
||||||
assert_equal "changed", @klass.new(@db_file)["foo"]
|
assert_equal "changed", @klass.new(@db_file)[:foo]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue