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

Accessing the Config file in a Test Target #348

Closed
etolstoy opened this issue May 14, 2015 · 5 comments
Closed

Accessing the Config file in a Test Target #348

etolstoy opened this issue May 14, 2015 · 5 comments

Comments

@etolstoy
Copy link
Contributor

Hi!
I've encountered a problem with using TyphoonConfig in a Test Target. When we load the config file by calling -useResourceWithName: method, [NSBundle mainBundle] is used under the hood. According to this SO answer, the config file cannot be found in the Test Target.
There is a workaround - I use the -useResourceWithPath: method, and generate the path using [NSBundle bundleForClass:].
Is this the desired behavior, or should I make a PR?

@etolstoy etolstoy changed the title Accessing the Config file in Test Target Accessing the Config file in a Test Target May 14, 2015
@jasperblues
Copy link
Member

I believe it needs to be this way for Swift: #329 (previously it was not).

Perhaps the best we can do is clearly document limitations, so that the workaround is clear.

@etolstoy
Copy link
Contributor Author

And why not to replace the -configDefinitionWithName: with -configDefinitionWithName:bundle:? I'm afraid that -configDefinitionWithName: in its current form will be useless and produce untypical bugs when accidentally used in the test target.

@jasperblues
Copy link
Member

That might be best actually. We can leave the old method there, but deprecate it. Or simply document that it implies the main bundle.

@etolstoy
Copy link
Contributor Author

Fine, I'll make the PR in a couple of days.

@jasperblues
Copy link
Member

Thanks so much. When can push a micro release when ready.

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

No branches or pull requests

2 participants