foreman/test/unit/fact_value_test.rb @ 5d264a2d
d8a93841 | Ohad Levy | require 'test_helper'
|
|
class FactValueTest < ActiveSupport::TestCase
|
|||
f4ec402d | José Luis Escalante | def setup
|
|
90b83222 | Ohad Levy | @host = hosts(:one)
|
|
5d264a2d | Ohad Levy | @fact_name = FactName.create(:name => "my_facting_name")
|
|
9fd7478e | Paul Kelly | @fact_value = FactValue.create(:value => "some value", :host => @host, :fact_name => @fact_name)
|
|
f4ec402d | José Luis Escalante | end
|
|
# test "should return the memory average" do
|
|||
# p FactValue.mem_average("my_facting_name")
|
|||
# end
|
|||
test "should return the count of each fact" do
|
|||
h = {"Some value"=>1}
|
|||
assert_equal h, FactValue.count_each("my_facting_name")
|
|||
#Now creating a new fact value
|
|||
90b83222 | Ohad Levy | @other_host = hosts(:two)
|
|
9fd7478e | Paul Kelly | other_fact_value = FactValue.create(:value => "some value", :host => @other_host, :fact_name => @fact_name)
|
|
f4ec402d | José Luis Escalante | h["Some value"] = 2
|
|
assert_equal h, FactValue.count_each("my_facting_name")
|
|||
d8a93841 | Ohad Levy | end
|
|
end
|