From b02f03a5569344fb4aa31637800c877155ad26db Mon Sep 17 00:00:00 2001 From: Yosuke Kabuto Date: Sat, 2 Jan 2016 16:19:08 +0900 Subject: [PATCH 1/8] Remove lines which add some paths to $LOAD_PATH, because they already exist in $LOAD_PATH --- spec/spec_helper.rb | 4 ---- spec/spec_helper/load_path_spec.rb | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 spec/spec_helper/load_path_spec.rb diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bb85032d5..99a3b1b29 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -19,10 +19,6 @@ GENERATED_DIR = File.expand_path(File.join(ROOT_DIR, 'generated')) THIRD_PARTY_DIR = File.expand_path(File.join(ROOT_DIR, 'third_party')) FIXTURES_DIR = File.expand_path(File.join(SPEC_DIR, 'fixtures')) -$LOAD_PATH.unshift(SPEC_DIR) -$LOAD_PATH.unshift(LIB_DIR) -$LOAD_PATH.unshift(GENERATED_DIR) -$LOAD_PATH.unshift(THIRD_PARTY_DIR) $LOAD_PATH.uniq! diff --git a/spec/spec_helper/load_path_spec.rb b/spec/spec_helper/load_path_spec.rb new file mode 100644 index 000000000..4d0139bb5 --- /dev/null +++ b/spec/spec_helper/load_path_spec.rb @@ -0,0 +1,30 @@ +# Copyright 2015 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'spec_helper' + +RSpec.describe $LOAD_PATH do + it('should contain SPEC_DIR') do + expect($LOAD_PATH).to include(SPEC_DIR) + end + it('should contain LIB_DIR') do + expect($LOAD_PATH).to include(LIB_DIR) + end + it('should contain GENERATED_DIR') do + expect($LOAD_PATH).to include(GENERATED_DIR) + end + it('should contain THIRD_PARTY_DIR') do + expect($LOAD_PATH).to include(THIRD_PARTY_DIR) + end +end From f6dc748cbd77dd9012df978d44fff94c28e4efa7 Mon Sep 17 00:00:00 2001 From: Yosuke Kabuto Date: Sat, 2 Jan 2016 16:41:04 +0900 Subject: [PATCH 2/8] Remove $LOAD_PATH.uniq! because $LOAD_PATH does not contain any duplicate path --- spec/spec_helper.rb | 3 --- spec/spec_helper/load_path_spec.rb | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 99a3b1b29..c8bd04378 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -19,9 +19,6 @@ GENERATED_DIR = File.expand_path(File.join(ROOT_DIR, 'generated')) THIRD_PARTY_DIR = File.expand_path(File.join(ROOT_DIR, 'third_party')) FIXTURES_DIR = File.expand_path(File.join(SPEC_DIR, 'fixtures')) -$LOAD_PATH.uniq! - - if defined?(JRUBY_VERSION) puts 'Skipping coverage on JRuby' else diff --git a/spec/spec_helper/load_path_spec.rb b/spec/spec_helper/load_path_spec.rb index 4d0139bb5..31fc1fed9 100644 --- a/spec/spec_helper/load_path_spec.rb +++ b/spec/spec_helper/load_path_spec.rb @@ -27,4 +27,7 @@ RSpec.describe $LOAD_PATH do it('should contain THIRD_PARTY_DIR') do expect($LOAD_PATH).to include(THIRD_PARTY_DIR) end + it('should already have unique path') do + expect($LOAD_PATH).to match_array($LOAD_PATH.uniq!) + end end From 8581c72a44b5742bae74a8f7302906ff64dc133f Mon Sep 17 00:00:00 2001 From: Yosuke Kabuto Date: Sat, 2 Jan 2016 16:42:29 +0900 Subject: [PATCH 3/8] Add space between specs --- spec/spec_helper/load_path_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/spec_helper/load_path_spec.rb b/spec/spec_helper/load_path_spec.rb index 31fc1fed9..21d4398ea 100644 --- a/spec/spec_helper/load_path_spec.rb +++ b/spec/spec_helper/load_path_spec.rb @@ -18,15 +18,19 @@ RSpec.describe $LOAD_PATH do it('should contain SPEC_DIR') do expect($LOAD_PATH).to include(SPEC_DIR) end + it('should contain LIB_DIR') do expect($LOAD_PATH).to include(LIB_DIR) end + it('should contain GENERATED_DIR') do expect($LOAD_PATH).to include(GENERATED_DIR) end + it('should contain THIRD_PARTY_DIR') do expect($LOAD_PATH).to include(THIRD_PARTY_DIR) end + it('should already have unique path') do expect($LOAD_PATH).to match_array($LOAD_PATH.uniq!) end From 1dbc4c3feed1ab4774e5a122b1af9ed5b533062a Mon Sep 17 00:00:00 2001 From: Yosuke Kabuto Date: Sat, 2 Jan 2016 16:53:25 +0900 Subject: [PATCH 4/8] Make word "path" plural --- spec/spec_helper/load_path_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper/load_path_spec.rb b/spec/spec_helper/load_path_spec.rb index 21d4398ea..1ecd45d4b 100644 --- a/spec/spec_helper/load_path_spec.rb +++ b/spec/spec_helper/load_path_spec.rb @@ -31,7 +31,7 @@ RSpec.describe $LOAD_PATH do expect($LOAD_PATH).to include(THIRD_PARTY_DIR) end - it('should already have unique path') do + it('should already have unique paths') do expect($LOAD_PATH).to match_array($LOAD_PATH.uniq!) end end From 3a8bc07686885b23a4ea5de598616ce251a9dbfd Mon Sep 17 00:00:00 2001 From: Yosuke Kabuto Date: Sat, 2 Jan 2016 19:52:36 +0900 Subject: [PATCH 5/8] Revert "Make word "path" plural" This reverts commit 1dbc4c3feed1ab4774e5a122b1af9ed5b533062a. --- spec/spec_helper/load_path_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper/load_path_spec.rb b/spec/spec_helper/load_path_spec.rb index 1ecd45d4b..21d4398ea 100644 --- a/spec/spec_helper/load_path_spec.rb +++ b/spec/spec_helper/load_path_spec.rb @@ -31,7 +31,7 @@ RSpec.describe $LOAD_PATH do expect($LOAD_PATH).to include(THIRD_PARTY_DIR) end - it('should already have unique paths') do + it('should already have unique path') do expect($LOAD_PATH).to match_array($LOAD_PATH.uniq!) end end From 59e8342469a440ac77ff4097b10c86a609b0c3cd Mon Sep 17 00:00:00 2001 From: Yosuke Kabuto Date: Sat, 2 Jan 2016 20:17:40 +0900 Subject: [PATCH 6/8] Revert "Revert "Make word "path" plural"" This reverts commit 3a8bc07686885b23a4ea5de598616ce251a9dbfd. --- spec/spec_helper/load_path_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper/load_path_spec.rb b/spec/spec_helper/load_path_spec.rb index 21d4398ea..1ecd45d4b 100644 --- a/spec/spec_helper/load_path_spec.rb +++ b/spec/spec_helper/load_path_spec.rb @@ -31,7 +31,7 @@ RSpec.describe $LOAD_PATH do expect($LOAD_PATH).to include(THIRD_PARTY_DIR) end - it('should already have unique path') do + it('should already have unique paths') do expect($LOAD_PATH).to match_array($LOAD_PATH.uniq!) end end From be71b0dbf2c3fc0225a2abfc2dbd018a274b8bf8 Mon Sep 17 00:00:00 2001 From: Yosuke Kabuto Date: Tue, 5 Jan 2016 14:19:56 +0900 Subject: [PATCH 7/8] Use bundler to execute test --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index aa59761e6..65ec7dbe0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ env: - RAILS_VERSION="~>4.0.0" - RAILS_VERSION="~>4.1.0" - RAILS_VERSION="~>4.2.0" -script: "rake spec:all" +script: "bundle exec rake spec:all" before_install: - sudo apt-get update - sudo apt-get install idn From a382d9be847db45dce870fc30fb4a453dd306ebb Mon Sep 17 00:00:00 2001 From: Yosuke Kabuto Date: Tue, 5 Jan 2016 15:18:56 +0900 Subject: [PATCH 8/8] Leave $LOAD_PATH.uniq! for jruby --- spec/spec_helper.rb | 2 ++ spec/spec_helper/load_path_spec.rb | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c8bd04378..879b2ebf6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -19,6 +19,8 @@ GENERATED_DIR = File.expand_path(File.join(ROOT_DIR, 'generated')) THIRD_PARTY_DIR = File.expand_path(File.join(ROOT_DIR, 'third_party')) FIXTURES_DIR = File.expand_path(File.join(SPEC_DIR, 'fixtures')) +$LOAD_PATH.uniq! + if defined?(JRUBY_VERSION) puts 'Skipping coverage on JRuby' else diff --git a/spec/spec_helper/load_path_spec.rb b/spec/spec_helper/load_path_spec.rb index 1ecd45d4b..9f6c70ad3 100644 --- a/spec/spec_helper/load_path_spec.rb +++ b/spec/spec_helper/load_path_spec.rb @@ -30,8 +30,4 @@ RSpec.describe $LOAD_PATH do it('should contain THIRD_PARTY_DIR') do expect($LOAD_PATH).to include(THIRD_PARTY_DIR) end - - it('should already have unique paths') do - expect($LOAD_PATH).to match_array($LOAD_PATH.uniq!) - end end