FakeWeb registering a url but ignore it afterwards #14

masterkain opened this Issue Feb 8, 2010 · 2 comments

2 participants


Registered URI:

[#<FakeWeb::Responder:0x106d219f8 @uri=/http:\/\/ws\.audioscrobbler\.com\/([^\/&]+)\/\?artist=([^\/&]+)&method=album.getinfo&api_key=([^\/&]+)&album=([^\/&]+)/, @method=:any, @times=1, @options={:body=>"<lfm status=\"ok\">trimmed</lfm>"}>]

Does not match


Real HTTP connections are disabled. Unregistered request: GET http://ws.audioscrobbler.com/2.0/?artist=Cher&method=album.getinfo&api_key=edited&album=Prisoner

Have a look at:


I forgot that if I hardcode the entire path string FakeWeb does its job, so the problem arises only when I pass a Regex object as second parameter.


It's because FakeWeb sorts your query parameters before matching against the regular expressions you've registered (this definitely needs to be better documented). So you need to write your regexp with that in mind.

For a write up of why it works that way, see #7.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment