From fd5aedeb019c71557a05fe48af33a502812d130f Mon Sep 17 00:00:00 2001 From: Florian Staudacher Date: Thu, 17 May 2012 01:50:50 +0200 Subject: [PATCH] updated webmock, hopefully fix cucumber --- Gemfile | 4 ++-- Gemfile.lock | 10 +++++----- features/not_safe_for_work.feature | 5 ++--- spec/models/jobs/http_multi_spec.rb | 5 ++++- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index c44664602..20c37f3ad 100644 --- a/Gemfile +++ b/Gemfile @@ -97,7 +97,7 @@ gem 'acts-as-taggable-on', '~> 2.2.2' # URIs and HTTP -gem 'addressable', '2.2.4', :require => 'addressable/uri' +gem 'addressable', '~> 2.2', :require => 'addressable/uri' gem 'http_accept_language', '~> 1.0.2' gem 'typhoeus' @@ -158,7 +158,7 @@ group :test do gem "rspec-rails", "~> 2.9.0" gem 'selenium-webdriver', '2.22.0.rc1' - gem 'webmock', :require => false + gem 'webmock', '~> 1.7', :require => false gem 'sqlite3' gem 'mock_redis' diff --git a/Gemfile.lock b/Gemfile.lock index e6e945feb..e4705b69a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -63,7 +63,7 @@ GEM activemodel (>= 3.0.0) activesupport (>= 3.0.0) rack (>= 1.1.0) - addressable (2.2.4) + addressable (2.2.8) airbrake (3.0.9) activesupport builder @@ -444,8 +444,8 @@ GEM rack (>= 1.0.0) warden (1.2.0) rack (>= 1.0) - webmock (1.6.2) - addressable (>= 2.2.2) + webmock (1.8.7) + addressable (>= 2.2.7) crack (>= 0.1.7) whenever (0.7.3) activesupport (>= 2.3.4) @@ -463,7 +463,7 @@ DEPENDENCIES activerecord-import (~> 0.2.9) acts-as-taggable-on (~> 2.2.2) acts_as_api - addressable (= 2.2.4) + addressable (~> 2.2) airbrake asset_sync bootstrap-sass (~> 2.0.2) @@ -549,7 +549,7 @@ DEPENDENCIES typhoeus uglifier unicorn (~> 4.3.0) - webmock + webmock (~> 1.7) whenever will_paginate yard diff --git a/features/not_safe_for_work.feature b/features/not_safe_for_work.feature index 3ef831782..a7cded4de 100644 --- a/features/not_safe_for_work.feature +++ b/features/not_safe_for_work.feature @@ -52,7 +52,6 @@ Scenario: Resharing an nsfw post And I preemptively confirm the alert And I follow "Reshare" And I wait for the ajax to finish - And I follow "Stream" - And I wait for the ajax to finish + And I go to the home page Then I should have 2 nsfw posts - And I should not see "Sexy Senators Gone Wild!" + Then I should not see "Sexy Senators Gone Wild!" diff --git a/spec/models/jobs/http_multi_spec.rb b/spec/models/jobs/http_multi_spec.rb index cf0061c00..78858dff8 100644 --- a/spec/models/jobs/http_multi_spec.rb +++ b/spec/models/jobs/http_multi_spec.rb @@ -2,17 +2,18 @@ require 'spec_helper' describe Jobs::HttpMulti do before :all do + WebMock.disable_net_connect!(:allow_localhost => true) enable_typhoeus end after :all do disable_typhoeus + WebMock.disable_net_connect! end before do @people = [Factory(:person), Factory(:person)] @post_xml = Base64.encode64("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH") - @hydra = Typhoeus::Hydra.new @response = Typhoeus::Response.new(:code => 200, :headers => "", :body => "", :time => 0.2, :effective_url => 'http://foobar.com') @failed_response = Typhoeus::Response.new(:code => 504, :headers => "", :body => "", :time => 0.2, :effective_url => 'http://foobar.com') @@ -71,6 +72,8 @@ describe Jobs::HttpMulti do person = @people.first person.url = 'http://remote.net/' person.save + + stub_request(:post, person.receive_url).to_return(:status=>200, :body=>"", :headers=>{}) response = Typhoeus::Response.new(:code => 301,:effective_url => 'https://foobar.com', :headers_hash => {"Location" => person.receive_url.sub('http://', 'https://')}, :body => "", :time => 0.2) @hydra.stub(:post, person.receive_url).and_return(response)