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

ConfigMock.mocks only use the first mock, right? #5

Open
vietstone-ng opened this issue Mar 2, 2017 · 3 comments
Open

ConfigMock.mocks only use the first mock, right? #5

vietstone-ng opened this issue Mar 2, 2017 · 3 comments

Comments

@vietstone-ng
Copy link

vietstone-ng commented Mar 2, 2017

Hi, I see

ConfigMock. mocks: [FireMockProtocol]

is an array, but in FireURLProtocol only the first element in the array is used

configMock.mocks.first

@Magiic
Copy link
Owner

Magiic commented Mar 2, 2017

Hi,

You right, the first element is used. This is an array because it allows to switch to the other elements with the custom view provide by the framework : FireMock.presentMockRegisters(from: self, backTapped: nil)
With this line, you can switch to other mocks added on registers function at runtime.

@vietstone-ng
Copy link
Author

Oh, I see. But I think FireURLProtocol should also check for all elements in the array to get the first appropriate mock in case no mock is selected from view :)

@Magiic
Copy link
Owner

Magiic commented Mar 3, 2017

By default the first mock registers in variadic parameter is selected. Because It's impossible to know which mock is appropriate, the first mock added is selected on the view and used at launch.

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