Skip to content

Instantly share code, notes, and snippets.

@shoaibmalik786
Created March 11, 2014 12:34
Show Gist options
  • Save shoaibmalik786/9484731 to your computer and use it in GitHub Desktop.
Save shoaibmalik786/9484731 to your computer and use it in GitHub Desktop.
unit test model
test "set key value" do
assert ConfigSetting.all.size > 1
end
test "found the value" do
assert_not_nil ConfigSetting.get('email')
end
test "return string value" do
email = ConfigSetting.get('email')
assert_equal email.class.to_s, "String"
end
test "return fixnum value" do
number = ConfigSetting.get('number')
assert_equal number.class.to_s, "Fixnum"
end
test "return True boolean value" do
flag = ConfigSetting.get('flag')
assert_equal flag.class.to_s, "TrueClass"
end
test "return False boolean value" do
flag = ConfigSetting.get('flag')
assert_equal flag.class.to_s, "FalseClass"
end
test "return float value" do
float = ConfigSetting.get('float')
assert_equal float.class.to_s, "Float"
end
test "incorrect key" do
assert_nil ConfigSetting.get('ahjmnhujhj')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment