Received: by 10.52.92.130 with SMTP id cm2mr303012vdb.2.1336577550286; Wed, 09 May 2012 08:32:30 -0700 (PDT) X-BeenThere: webmock-users@googlegroups.com Received: by 10.52.33.167 with SMTP id s7ls1531831vdi.5.gmail; Wed, 09 May 2012 08:32:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.66.44 with SMTP id c12mr42049vdt.19.1336577549870; Wed, 09 May 2012 08:32:29 -0700 (PDT) Authentication-Results: ls.google.com; spf=pass (google.com: domain of ticktricktr...@gmail.com designates internal as permitted sender) smtp.mail=ticktricktr...@gmail.com; dkim=pass header...@gmail.com Received: by l15g2000vbv.googlegroups.com with HTTP; Wed, 9 May 2012 08:32:29 -0700 (PDT) Date: Wed, 9 May 2012 08:32:29 -0700 (PDT) In-Reply-To: References: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.5 Safari/534.55.3,gzip(gfe) Message-ID: <057a5ffc-4fd0-4bbf-8aa1-bd1ee85792a9@l15g2000vbv.googlegroups.com> Subject: Re: Need help testing response status codes From: Ray To: webmock-users Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I'm using gem 'httparty', '0.8.3' gem 'webmock', '1.8.6', :group =3D> :test It runs fine in IRB, but not in RAILS_ENV=3Dtest rails console. I'm guessing it's either a conflict with another gem or possibly a load order issue. I created a blank rails project and I'm trying to home in on the error source. On May 9, 4:15=A0pm, Pete Higgins wrote: > On Wed, May 9, 2012 at 4:43 AM, Ray wrote: > > I have had no luck at all to get any useful behaviour out of WebMock. > > Here is what I have in my Specs. > > > stub_request(:get, "https://example.com/some_name"). > > =A0to_return(:status =3D> 503, :body =3D> "", :headers =3D> {}) > > > response =3D HTTParty.get( "https://example.com/some_name" ) > > =3D> nil > > > response =3D Net::HTTP.get(URI.parse("https://example.com/some_name") > > =3D> "" > > response.class > > =3D> String > > > Environment: > > Rails 3.2.3, Ruby 1.9.3-p125, OS X, Webmock '1.8.6' > > What version of HTTParty are you using? With the latest release of it and > Webmock I am not seeing the same behavior: > > $ irb>> require 'webmock' > =3D> true > >> include WebMock::API > =3D> Object > >> require 'httparty' > =3D> true > >> stub_request(:get, "https://example.com/some_name").to_return(:status = =3D> > > 503, :body =3D> "", :headers =3D> {}) > =3D> GET https:examplecomsome_name>> response =3D HTTParty.get("https://e= xample.com/some_name") > > =3D> # @response=3D#, header= s{}>> response.class > > =3D> HTTParty::Response>> WebMock::VERSION > =3D> "1.8.6" > >> HTTParty::VERSION > > =3D> "0.8.3" >