-
-
Save steveburkett/1181807 to your computer and use it in GitHub Desktop.
it "should lookup by last_updated for abc files" do | |
update_time = Time.now | |
# create a location to match this update_time here | |
file = double("file") | |
file.should_receive(:extension).and_return("abc") | |
file.should_receive(:last_update).and_return(update_time) | |
MyClass.load_file(file).should == Location.find_by_lookup(update_time) | |
end | |
it "should lookup by extension for all other files" do | |
# create a location to match the "def" extension here | |
file = double("file") | |
file.should_receive(:extension).twice.and_return("def") | |
file.should_not_receive(:last_update) | |
MyClass.load_file(file).should == Location.find_by_lookup("def") | |
end |
The whole point of compilers, interpreters, layers of abstraction are to shorten the semantic distance between our intent and the way the computer thinks of things. In the pure sense, a compiler is a fancy spell checker. Your intent should be expressed thru tests, and then thru code.
Hmm. I like what you are saying Steve. I agree that compilers are glorified spell-checkers, maybe a little more (contract consistency checkers?). You could also think of it as an automatic test generator/runner, for a certain trivial class of tests. But this suggests that code written in Ruby ought to demand more unit tests be written than c# demands. I'm pretty cool with that -- leaning on good tests instead of a compiler sounds great. Does it jive with your comments about 80/20 on test coverage, too many tests are a mistake, etc? Doesn't this suggest that any decent Ruby developer ought to look at the test coverage reached by a c# dev and laugh at their piteousness?
yes, this is why Ruby is "test mad". My comment on 80/20 was more the amount of emphasis on testing behaviors vs emphasis on test coverage (w/ legacy code). When u r doing TDD, like you said, you're getting great test coverage by default. I hope all the language worlds can get together and help learn from each other rather than laugh at piteousness.
Lol, maybe they can all sing kumbaya around a camp fire too. I've got to make some time for Ruby soon, but JS and java both keep getting in the way. Oh well.
I have fond memories of singing kumbaya around a campfire
in Ruby, do DO need tests that test desired behaviors (e.g., use of last_update). that way, if last_update was renamed to last_updated, that test would fail.