Wrapping tests in meaningful context

This commit is contained in:
Mitchell Hashimoto 2010-04-11 23:42:11 -07:00
parent 945710e068
commit aa52d977a8
1 changed files with 13 additions and 11 deletions

View File

@ -121,18 +121,20 @@ class ConfigTest < Test::Unit::TestCase
end end
end end
should "convert instance variable hash to json" do context "converting to JSON" do
@json = mock("json") should "convert instance variable hash to json" do
@iv_hash = mock("iv_hash") @json = mock("json")
@iv_hash.expects(:to_json).once.returns(@json) @iv_hash = mock("iv_hash")
@base.expects(:instance_variables_hash).returns(@iv_hash) @iv_hash.expects(:to_json).once.returns(@json)
assert_equal @json, @base.to_json @base.expects(:instance_variables_hash).returns(@iv_hash)
end assert_equal @json, @base.to_json
end
should "not include env in the JSON hash" do should "not include env in the JSON hash" do
@base.env = "FOO" @base.env = "FOO"
hash = @base.instance_variables_hash hash = @base.instance_variables_hash
assert !hash.has_key?(:env) assert !hash.has_key?(:env)
end
end end
end end