From aa52d977a898caf2f99017f1f469ac68e70bf97a Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 11 Apr 2010 23:42:11 -0700 Subject: [PATCH] Wrapping tests in meaningful context --- test/vagrant/config_test.rb | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/test/vagrant/config_test.rb b/test/vagrant/config_test.rb index 82bcffd61..ac2a1a7e4 100644 --- a/test/vagrant/config_test.rb +++ b/test/vagrant/config_test.rb @@ -121,18 +121,20 @@ class ConfigTest < Test::Unit::TestCase end end - should "convert instance variable hash to json" do - @json = mock("json") - @iv_hash = mock("iv_hash") - @iv_hash.expects(:to_json).once.returns(@json) - @base.expects(:instance_variables_hash).returns(@iv_hash) - assert_equal @json, @base.to_json - end + context "converting to JSON" do + should "convert instance variable hash to json" do + @json = mock("json") + @iv_hash = mock("iv_hash") + @iv_hash.expects(:to_json).once.returns(@json) + @base.expects(:instance_variables_hash).returns(@iv_hash) + assert_equal @json, @base.to_json + end - should "not include env in the JSON hash" do - @base.env = "FOO" - hash = @base.instance_variables_hash - assert !hash.has_key?(:env) + should "not include env in the JSON hash" do + @base.env = "FOO" + hash = @base.instance_variables_hash + assert !hash.has_key?(:env) + end end end