Skip to content

Commit

Permalink
Stub requests for both ruby 1.9.2 and 1.9.3, ruby 1.9.2 expects the e…
Browse files Browse the repository at this point in the history
…scaped URL to be downcased and 1.9.3 expects it not to be.
  • Loading branch information
carols10cents committed Apr 21, 2012
1 parent 9651b12 commit 95d0840
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/models/user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
def stub_superfeedr_request_for_user(user)
user_feed_url = CGI.escape(user.feed.url(true))

# Downcase the escaped user_feed_url for ruby 1.9.2
stub_request(:post, "http://rstatus.superfeedr.com/").
with(:body => "hub.mode=publish&hub.url=#{user_feed_url.downcase}",
:headers => { 'Accept' => '*/*',
'Content-Type' => 'application/x-www-form-urlencoded',
'User-Agent' => 'Ruby'}).
to_return(:status => 200, :body => "", :headers => {})

# Leave the escaped user_feed_url as it is for ruby 1.9.3
stub_request(:post, "http://rstatus.superfeedr.com/").
with(:body => "hub.mode=publish&hub.url=#{user_feed_url}",
:headers => { 'Accept' => '*/*',
Expand Down

0 comments on commit 95d0840

Please sign in to comment.