8 ms·
Can't tell if serious...
by alecbenzer 6y ago
Can't tell if serious...
- sys_64738 6y agoThey are. If you don't get it then you're doing it wrong.
- eithed 6y agoI'm serious. Of course you don't test that language operations work, but you're testing that given method does what it's supposed to do. In this case your method sets value for property on model. It doesn't matter you're doing it via assignment - you could be doing it by any other ways. You want to test that for given model after calling that method your models property will change to given value. This way, if you'll change the implementation of setValue your test will still succeed. If it'll start doing something else, they will fail. And of course, this method can be used in your feature tests, so those will start failing too (but that's beside the point, I guess) Of course it's also a balancing act - should you immediately write test for this? I try to.