FakeWeb registering a url but ignore it afterwards #14

Closed
masterkain opened this Issue Feb 8, 2010 · 2 comments

2 participants

@masterkain

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

http://ws.audioscrobbler.com/2.0/?artist=Cher&method=album.getinfo&api_key=edited&album=Prisoner

Error:
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:
http://rubular.com/regexes/13511

@masterkain

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.

@chrisk
Owner

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