but in the test when i create a new data object the the method will be
invoked via initialize before ive even tested it which doesnt sit right
with me.
Should i be mocking this? Or is there a simpler solution to this.
but in the test when i create a new data object the the method will be
invoked via initialize before ive even tested it which doesnt sit right
with me.
Should i be mocking this? Or is there a simpler solution to this.
Hmm seems you want to test something you did not implement.
A first but radical measure would be to do some [BT]DD. That means
that you have to throw away your code because you simply do not hava
any right to write code that does not make any tests pass… Then
write your tests (I prefer specs or behaviors) and then implement
them. Now your issue above should be a non issue (I guess, but if it
is please post again).
but in the test when i create a new data object the the method will be
invoked via initialize before ive even tested it which doesnt sit right
with me.
What harm is going to come of letting parse_file run before the
assertion which tests it? I don’t understand your concern.
IMNSHO, the assignment to @records should occur inside of parse_file,
OR parse_file should be private.
Should i be mocking this? Or is there a simpler solution to this.
Avoid mocks unless they’re really necessary.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.