From 65a738e60448401bb2cf86a621e548b2e4ab54c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonne=20Ha=C3=9F?= Date: Tue, 24 Mar 2015 22:28:48 +0100 Subject: [PATCH] bump rspec-rails --- Gemfile | 2 +- Gemfile.lock | 41 ++++++++++++++++++------------------ features/support/env.rb | 4 +++- spec/models/reshare_spec.rb | 22 +++++++++++++++---- spec/spec_helper.rb | 2 ++ spec/support/user_methods.rb | 7 +----- 6 files changed, 46 insertions(+), 32 deletions(-) diff --git a/Gemfile b/Gemfile index 47f35d51e..7790349ff 100644 --- a/Gemfile +++ b/Gemfile @@ -263,7 +263,7 @@ end group :development, :test do # RSpec (unit tests, some integration tests) - gem "rspec-rails", "3.1.0" + gem "rspec-rails", "3.2.1" # Cucumber (integration tests) gem "cucumber-rails", "1.4.2", require: false diff --git a/Gemfile.lock b/Gemfile.lock index 9104efb0a..8e7bd1f1a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -571,28 +571,29 @@ GEM roxml (3.1.6) activesupport (>= 2.3.0) nokogiri (>= 1.3.3) - rspec (3.1.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-core (3.1.7) - rspec-support (~> 3.1.0) - rspec-expectations (3.1.2) + rspec (3.2.0) + rspec-core (~> 3.2.0) + rspec-expectations (~> 3.2.0) + rspec-mocks (~> 3.2.0) + rspec-core (3.2.2) + rspec-support (~> 3.2.0) + rspec-expectations (3.2.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.1.0) + rspec-support (~> 3.2.0) rspec-instafail (0.2.6) rspec - rspec-mocks (3.1.3) - rspec-support (~> 3.1.0) - rspec-rails (3.1.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-support (~> 3.1.0) - rspec-support (3.1.2) + rspec-mocks (3.2.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.2.0) + rspec-rails (3.2.1) + actionpack (>= 3.0, < 4.3) + activesupport (>= 3.0, < 4.3) + railties (>= 3.0, < 4.3) + rspec-core (~> 3.2.0) + rspec-expectations (~> 3.2.0) + rspec-mocks (~> 3.2.0) + rspec-support (~> 3.2.0) + rspec-support (3.2.2) rubocop (0.29.1) astrolabe (~> 1.3) parser (>= 2.2.0.1, < 3.0) @@ -795,7 +796,7 @@ DEPENDENCIES responders (= 2.1.0) roxml (= 3.1.6) rspec-instafail (= 0.2.6) - rspec-rails (= 3.1.0) + rspec-rails (= 3.2.1) rubocop (= 0.29.1) ruby-oembed (= 0.8.12) sass-rails (= 5.0.1) diff --git a/features/support/env.rb b/features/support/env.rb index 44b379203..5e6b81174 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -13,7 +13,9 @@ require 'capybara/session' #require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript # Ensure we know the appservers port -Capybara.server_port = 9887 +Capybara.server_port = AppConfig.pod_uri.port +Rails.application.routes.default_url_options[:host] = AppConfig.pod_uri.host +Rails.application.routes.default_url_options[:port] = AppConfig.pod_uri.port # Use a version of Firefox defined by environment variable, if set Capybara.register_driver :selenium do |app| diff --git a/spec/models/reshare_spec.rb b/spec/models/reshare_spec.rb index 86da365db..155ac527d 100644 --- a/spec/models/reshare_spec.rb +++ b/spec/models/reshare_spec.rb @@ -1,8 +1,6 @@ require 'spec_helper' describe Reshare, :type => :model do - include Rails.application.routes.url_helpers - it 'has a valid Factory' do expect(FactoryGirl.build(:reshare)).to be_valid end @@ -207,7 +205,15 @@ describe Reshare, :type => :model do allow(@response).to receive(:body).and_return(@root_object.to_diaspora_xml) - expect(Faraday.default_connection).to receive(:get).with(URI.join(@original_author.url, short_post_path(@root_object.guid, :format => "xml"))).and_return(@response) + expect(Faraday.default_connection).to receive(:get).with( + URI.join( + @original_author.url, + Rails.application.routes.url_helpers.short_post_path( + @root_object.guid, + format: "xml" + ) + ) + ).and_return(@response) Reshare.from_xml(@xml) end @@ -235,7 +241,15 @@ describe Reshare, :type => :model do context 'saving the post' do before do allow(@response).to receive(:body).and_return(@root_object.to_diaspora_xml) - allow(Faraday.default_connection).to receive(:get).with(URI.join(@reshare.root.author.url, short_post_path(@root_object.guid, :format => "xml"))).and_return(@response) + allow(Faraday.default_connection).to receive(:get).with( + URI.join( + @reshare.root.author.url, + Rails.application.routes.url_helpers.short_post_path( + @root_object.guid, + format: "xml" + ) + ) + ).and_return(@response) end it 'fetches the root post from root_guid' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index afda99679..32937f978 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -20,6 +20,8 @@ end ProcessedImage.enable_processing = false UnprocessedImage.enable_processing = false +Rails.application.routes.default_url_options[:host] = AppConfig.pod_uri.host +Rails.application.routes.default_url_options[:port] = AppConfig.pod_uri.port def set_up_friends [local_luke, local_leia, remote_raphael] diff --git a/spec/support/user_methods.rb b/spec/support/user_methods.rb index 4d897f018..85f0068f7 100644 --- a/spec/support/user_methods.rb +++ b/spec/support/user_methods.rb @@ -1,9 +1,4 @@ class User - include Rails.application.routes.url_helpers - def default_url_options - {:host => AppConfig.pod_uri.host} - end - alias_method :share_with_original, :share_with def share_with(*args) @@ -22,7 +17,7 @@ class User self.aspects.reload add_to_streams(p, aspects) - dispatch_opts = {:url => post_url(p), :to => opts[:to]} + dispatch_opts = {url: Rails.application.routes.url_helpers.post_url(p), to: opts[:to]} dispatch_opts.merge!(:additional_subscribers => p.root.author) if class_name == :reshare dispatch_post(p, dispatch_opts) end