R
Ruby Pasaulyje
I have a problem with mocking. I have class DistanceMatrix and I would
like to indicate which method form_matrix is called in if/else
statement. I need to use mocha and rspec. Any ideas?
class DistanceMatrix
def initialize(*args)
if args[0].class == String
form_matrix(get_data_from_yaml(args[0], args[1]))
elsif args[0].class == Array || args[0] == nil
form_matrix(get_data_from_db(args[0]))
end
end
def form_matrix()
...
end
end
like to indicate which method form_matrix is called in if/else
statement. I need to use mocha and rspec. Any ideas?
class DistanceMatrix
def initialize(*args)
if args[0].class == String
form_matrix(get_data_from_yaml(args[0], args[1]))
elsif args[0].class == Array || args[0] == nil
form_matrix(get_data_from_db(args[0]))
end
end
def form_matrix()
...
end
end