Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Tests to Specs. #292

Merged
merged 39 commits into from
Nov 18, 2013
Merged

Convert Tests to Specs. #292

merged 39 commits into from
Nov 18, 2013

Conversation

tiennou
Copy link
Contributor

@tiennou tiennou commented Nov 7, 2013

Here are rewritten tests (and some new ones I think, see if you can spot them ;-)) using Specta/Expecta. I've only left GTObjectTest because I'm not sure what I should salvage yet because 3 tests on 5 are actually testing GTRepository...

@tiennou
Copy link
Contributor Author

tiennou commented Nov 7, 2013

This needs #280 before the clone test will go green.

@@ -73,6 +76,9 @@ - (id)initWithString:(NSString *)string inRepository:(GTRepository *)repository
}

- (id)initWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError **)error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also document the header for this method? We should specify that data and repository may not be nil

//
// This copies the data from the file to the repository's object database.
//
// data - The file to copy contents from.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May not be nil.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, how about we agree on defaulting to "unspecified" => "mandatory argument" ? I'm not fond of having to go through every docblock out there and add that info, and the "optional" argument case is much less frequent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are actually relatively few methods which assert paramaters as not being nil, throughout the codebase.

If something will throw an exception if you pass in nil it should absolutely be documented.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see both sides of this argument, but ObjectiveGit is probably the wrong example to look at here, since it's kinda crufty in many places.

I'm 👍 on @tiennou's suggestion (for all our OSS), though it'll take some time before ObjectiveGit's documentation actually gets to a state where it matches our expectations.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I'm fine with that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems incredibly backwards to me that we wouldn't document something which throws an exception.

@alanjrogers
Copy link
Contributor

@tiennou I just started re-reviewing this without checking you were done, sorry about that! Carry on 💃 .

Conflicts:
	Classes/GTDiff.m
@tiennou
Copy link
Contributor Author

tiennou commented Nov 11, 2013

I'm the sorry one here — it was mostly ready, except for the lone fixup! commit I pushed by mistake :-S. It's fixed now so you can proceed.

@@ -176,7 +176,7 @@
- (id)lookupObjectBySHA:(NSString *)sha error:(NSError **)error;

// Lookup an object in the repo using a revparse spec
- (id)lookupObjectByRefspec:(NSString *)spec error:(NSError **)error;
- (id)lookupObjectByRevspec:(NSString *)spec error:(NSError **)error;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename this method to -lookupObjectByRevParse:error:.

That way it's less likely to be confused with a Refspec.

@alanjrogers
Copy link
Contributor

🌴 Just one comment left :)

@alanjrogers alanjrogers reopened this Nov 12, 2013
@tiennou
Copy link
Contributor Author

tiennou commented Nov 12, 2013

I've done the refspec renaming somewhere else. If that one's merged I got a bunch of others to review, which I'll push ASAP (my net access isn't good at the moment).

@tiennou tiennou mentioned this pull request Nov 12, 2013
@alanjrogers
Copy link
Contributor

@tiennou It looks like that PR won't get merged quickly as it's a lot of changes. Since we're renaming -lookupObjectByRefspec:error: here anyway, it would be good to give it a better name while we're at it.

@tiennou
Copy link
Contributor Author

tiennou commented Nov 18, 2013

:suspect:

alanjrogers pushed a commit that referenced this pull request Nov 18, 2013
@alanjrogers alanjrogers merged commit 617d416 into master Nov 18, 2013
@alanjrogers alanjrogers deleted the tests-to-specs branch November 18, 2013 22:49
phatblat pushed a commit to phatblat/objective-git that referenced this pull request Sep 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants