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

Inconsistently raising NocillaUnexpectedRequest exception #28

Closed
brendanjerwin opened this issue May 29, 2013 · 4 comments
Closed

Inconsistently raising NocillaUnexpectedRequest exception #28

brendanjerwin opened this issue May 29, 2013 · 4 comments

Comments

@brendanjerwin
Copy link

I've tried both the currently released and HEAD versions. Currently using the HEAD version.

This is a snip from my log:

2013-05-29 08:26:54.097 GRC_Consumer[34040:c07] Enabled View and Notification Observation. (<SparkInspector: 0x975b0a0>)
2013-05-29 08:26:54:100 GRC_Consumer[34040:c07] Application did finish launching with options: (null)
2013-05-29 08:26:54:101 GRC_Consumer[34040:c07] Setting up fixture data. 
...
2013-05-29 08:26:54.506 GRC_Consumer[34040:6a03] *** Terminating app due to uncaught exception 'NocillaUnexpectedRequest', reason: 'An unexcepted HTTP request was fired.

Use this snippet to stub the request:
stubRequest(@"GET", @"https://foo/bar").
withHeaders(@{ @"Accept": @"application/json", @"Accept-Language": @"en;q=1, fr;q=0.9, de;q=0.8, ja;q=0.7, nl;q=0.6, it;q=0.5", @"User-Agent": @"GRC_Consumer/1.0 (iPad Simulator; iOS 6.1; Scale/1.00)" });
'
*** First throw call stack:
(0x2364012 0x1c15e7e 0x2363deb 0xd18e0 0x1939a97 0x18a975a 0x1877453 0x1877164 0x1938a73 0x1939122 0x1939a57 0x193ad95 0x193ac9c 0x479e09 0x49e7f7 0x49c76c 0x4d5cda 0x23068fd 0x4d635c 0x4d62d5 0x3c0250 0x22e7f3f 0x22e796f 0x230a734 0x2309f44 0x2309e1b 0x19415ee 0x1889805 0x1889764 0x97db05b7 0x97d9ad4e)
libc++abi.dylib: terminate called throwing an exception
(lldb) 

Notice the line "Setting up fixture data". That is where I stub the request. Notice that it happens prior to getting the exception.

It is not every time I run either. However, I've not been able to detect any external cause. I suspect a timing error in Nocilla.

What can I do to help diagnose this?

@brendanjerwin
Copy link
Author

I tried making a few key properties atomic. Didn't seem to help, :(

@luisobo
Copy link
Owner

luisobo commented May 30, 2013

Make sure that your tests is waiting for the request to finish. In Kiwi you
need to use [expectFutureValue(soemthing) shouldEventually] equal:@"foo"];

This way you tests will wait until the request finishes and only then it
will clear the stubs. My guess is that currently your stubs are being
cleared before the request has triggered.

Can I see your tests?

2013/5/30 Brendan Erwin notifications@github.com

I tried making a few key properties atomic. Didn't seem to help, :(


Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-18692904
.

@brendanjerwin
Copy link
Author

That was it!

I had expectFutureValue on some of my it statements, but not all of them. But I do have the afterEach which clears the stubs.

Thanks a lot.

@luisobo
Copy link
Owner

luisobo commented May 30, 2013

No problem. Glad that it worked :)

2013/5/30 Brendan Erwin notifications@github.com

That was it!

I had expectFutureValue on some of myits, but not all of them. But I do
have theafterEach` which clears the stubs.

Thanks a lot.


Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-18704798
.

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