Am trying to evaluating the below code using rspec.
Given :
# book = ...
Rails.logger.info book.inspect
The above code prints the value of return type is boolean i.e {:foo=>false}
eval(book[:foo]).should be_false
but that doesn’t seem to work. While trying to run rspec, it throws the following exception:
Failure/Error: eval(book[:foo]).should be_false TypeError: can't convert false into String
So, how can i evaluate a boolean to a method, such as my final result would be the equivalent ?
evalexecutes passed argument interpreting it as Ruby code. What Ruby code do you think is contained infalseobject?see the difference?
i don’t know what exactly are you testing but you could simply try