core: add tests for MachineReadable and frozen strings

This commit is contained in:
Mitchell Hashimoto 2014-01-21 12:13:54 -08:00
parent 06f1ebf752
commit d81af187ea
1 changed files with 13 additions and 0 deletions

View File

@ -199,6 +199,19 @@ describe Vagrant::UI::MachineReadable do
subject.machine(:type, "foo\nbar\r")
end
# This is for a bug where JSON parses are frozen and an
# exception was being raised.
it "works properly with frozen string arguments" do
subject.should_receive(:safe_puts).with do |message|
parts = message.split(",")
expect(parts.length).to eq(4)
expect(parts[3]).to eq("foo\\nbar\\r")
true
end
subject.machine(:type, "foo\nbar\r".freeze)
end
end
end