Skip to content

Commit

Permalink
Simplify WebMock request stubbing
Browse files Browse the repository at this point in the history
  • Loading branch information
stewart committed Oct 15, 2013
1 parent b432cf0 commit 799e23c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 0 additions & 5 deletions spec/gabba_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,4 @@
@gabba.must_be_instance_of Gabba::Gabba
end
end

def stub_analytics(expected_params)
s = stub_request(:get, /www.google-analytics.com\/__utm.gif\?utmac=#{expected_params[:utmac]}&.*/).
to_return(:status => 200, :body => "", :headers => {})
end
end
11 changes: 9 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@
require 'minitest/autorun'
require 'minitest/pride'

require 'webmock'
include WebMock::API
require 'webmock/minitest'
WebMock.disable_net_connect!

def stub_analytics(expected_params)
stub_request(
:get,
/www.google-analytics.com\/__utm.gif\?utmac=#{expected_params[:utmac]}&.*/
).to_return(:status => 200, :body => '', :headers => {})
end

0 comments on commit 799e23c

Please sign in to comment.