Re factor compiler specs to use 'let','match_array','expect',be_nil'#968
Re factor compiler specs to use 'let','match_array','expect',be_nil'#9681 commit merged intojruby:masterfrom rajcybage:refactor_rspec
Conversation
|
Please change the subject to use imperative; e.g., "Refactor compiler specs to use 'let'" |
|
hi @BanzaiMan not only let but also many other like be_nil inspite of nil and also match_array,expect so in commit message should I mention all these thanks |
|
Done Thanks you @BanzaiMan |
|
If it is acceptable then I can proceed to modify many other rspec codes which are still written in older style Thanks |
Re factor compiler specs to use 'let','match_array','expect',be_nil'
|
Doesn't changing from the == matcher to match_array makes the tests weaker (they no longer assert on array order)? Wouldn't the eq matcher (which is the same as == but works with the new expect syntax) be the better choice? My other concern is more to do with test readability: moving the array called "expected" all the way up to the top of the file makes it less clear what that assertion is doing. Edit: Same goes for "base" being extracted to a let. It's no longer local to where it's being used, and it's not shared between examples so there doesn't seem to be any advantage to using a let. |
|
Please look into Expected vs should for better rspec http://betterspecs.org/#expect yes all |
|
Please look into the time taken by expect less than should |
|
I'm not disagreeing with the switch from "should" to "expect" (though I wouldn't use that benchmark to justify it, but that's another story*). What I'm saying should be changed is:
* For those interested in why I don't think those benchmark numbers are a good justification:
|
fix the should to expect use let use match_array instead of == use be_nil instead of nil also use expect block instead of lamda block