From b60033322ad11d88e2d4505c78b86035bb86b58d Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Sun, 18 Nov 2018 22:57:51 +0100 Subject: [PATCH] Change RSpec shared_context usage to avoid warnings --- spec/core/build_spec.rb | 4 ++-- spec/core/checks_spec.rb | 2 +- spec/core/compile_spec.rb | 2 +- spec/core/shell_spec.rb | 2 +- spec/ide/eclipse_spec.rb | 2 +- spec/java/packaging_spec.rb | 6 +++--- spec/java/test_coverage_helper.rb | 2 +- spec/kotlin/compiler_spec.rb | 14 +++++++------- spec/packaging/archive_spec.rb | 2 +- spec/packaging/packaging_helper.rb | 2 +- spec/scala/compiler_spec.rb | 14 +++++++------- 11 files changed, 26 insertions(+), 26 deletions(-) diff --git a/spec/core/build_spec.rb b/spec/core/build_spec.rb index b1953c747..8df189a11 100644 --- a/spec/core/build_spec.rb +++ b/spec/core/build_spec.rb @@ -16,7 +16,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers')) -shared_examples_for 'local task' do +RSpec.shared_examples 'local task' do it "should execute task for project in current directory" do define 'foobar' lambda { @task.invoke }.should run_task("foobar:#{@task.name}") @@ -387,7 +387,7 @@ end -shared_examples_for 'a release process' do +RSpec.shared_examples 'a release process' do describe '#make' do before do diff --git a/spec/core/checks_spec.rb b/spec/core/checks_spec.rb index 4232bff49..edb152c9a 100644 --- a/spec/core/checks_spec.rb +++ b/spec/core/checks_spec.rb @@ -343,7 +343,7 @@ describe Buildr::Checks::Expectation do - shared_examples_for 'all archive types' do + RSpec.shared_examples 'all archive types' do before do archive = @archive diff --git a/spec/core/compile_spec.rb b/spec/core/compile_spec.rb index 69e5037a2..f3f23d1b5 100644 --- a/spec/core/compile_spec.rb +++ b/spec/core/compile_spec.rb @@ -428,7 +428,7 @@ def jars end -shared_examples_for 'accessor task' do +RSpec.shared_examples 'accessor task' do it 'should return a task' do define('foo').send(@task_name).should be_kind_of(Rake::Task) end diff --git a/spec/core/shell_spec.rb b/spec/core/shell_spec.rb index b8766e102..c5713076a 100644 --- a/spec/core/shell_spec.rb +++ b/spec/core/shell_spec.rb @@ -102,7 +102,7 @@ end end -shared_examples_for "shell provider" do +RSpec.shared_examples "shell provider" do it 'should have launch method accepting shell task' do @instance.method(:launch).should_not be_nil diff --git a/spec/ide/eclipse_spec.rb b/spec/ide/eclipse_spec.rb index 7ecb2bc5f..f50af1a03 100644 --- a/spec/ide/eclipse_spec.rb +++ b/spec/ide/eclipse_spec.rb @@ -382,7 +382,7 @@ def classpath_containers(attribute='path') write 'src/test/java/Test.java' end - shared_examples_for 'source' do + RSpec.shared_examples 'source' do it 'should ignore CVS and SVN files' do define('foo') classpath_sources('excluding').each do |excluding_attribute| diff --git a/spec/java/packaging_spec.rb b/spec/java/packaging_spec.rb index a13f4a40f..499fb1065 100644 --- a/spec/java/packaging_spec.rb +++ b/spec/java/packaging_spec.rb @@ -53,7 +53,7 @@ end -shared_examples_for 'package with manifest' do +RSpec.shared_examples 'package with manifest' do before do @long_line = 'No line may be longer than 72 bytes (not characters), in its UTF8-encoded form. If a value would make the initial line longer than this, it should be continued on extra lines (each starting with a single SPACE).' end @@ -347,7 +347,7 @@ module AccessManifestTMP end -shared_examples_for 'package with meta_inf' do +RSpec.shared_examples 'package with meta_inf' do def package_with_meta_inf(meta_inf = nil) packaging = @packaging @@ -1258,7 +1258,7 @@ def inspect_classpath(package) end end -shared_examples_for 'package_with_' do +RSpec.shared_examples 'package_with_' do def prepare(options = {}) packager = "package_with_#{@packaging}" diff --git a/spec/java/test_coverage_helper.rb b/spec/java/test_coverage_helper.rb index 1651c97f7..ae72c0ce4 100644 --- a/spec/java/test_coverage_helper.rb +++ b/spec/java/test_coverage_helper.rb @@ -53,7 +53,7 @@ def have_files_matching pattern end end -shared_examples_for 'test coverage tool' do +RSpec.shared_examples 'test coverage tool' do include TestCoverageHelper def toolname diff --git a/spec/kotlin/compiler_spec.rb b/spec/kotlin/compiler_spec.rb index 200f60a1b..5d2788440 100644 --- a/spec/kotlin/compiler_spec.rb +++ b/spec/kotlin/compiler_spec.rb @@ -17,7 +17,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers')) # need to test both with and without KOTLIN_HOME -share_as :KotlincCompiler do +RSpec.shared_examples 'KotlincCompiler' do it 'should identify itself from source directories' do write 'src/main/kotlin/com/example/Test.kt', "package com.example\n class Test { }" @@ -110,7 +110,7 @@ def define_test1_project end end -share_as :KotlincCompiler_CommonOptions do +RSpec.shared_examples 'KotlincCompiler_CommonOptions' do it 'should set warnings option to false by default' do compile_task.options.warnings.should be_false @@ -240,8 +240,8 @@ def compile_task @compile_task ||= define('foo').compile.using(:kotlinc) end - it_should_behave_like KotlincCompiler - it_should_behave_like KotlincCompiler_CommonOptions + it_should_behave_like 'KotlincCompiler' + it_should_behave_like 'KotlincCompiler_CommonOptions' end end @@ -264,11 +264,11 @@ def kotlinc_args compile_task.instance_eval { @compiler }.send(:kotlinc_args) end - it_should_behave_like KotlincCompiler - it_should_behave_like KotlincCompiler_CommonOptions + it_should_behave_like 'KotlincCompiler' + it_should_behave_like 'KotlincCompiler_CommonOptions' after :all do ENV['KOTLIN_HOME'] = old_home end end -end \ No newline at end of file +end diff --git a/spec/packaging/archive_spec.rb b/spec/packaging/archive_spec.rb index 46f1151c2..827c4e890 100644 --- a/spec/packaging/archive_spec.rb +++ b/spec/packaging/archive_spec.rb @@ -60,7 +60,7 @@ def init_dir end end -shared_examples_for 'ArchiveTask' do +RSpec.shared_examples 'ArchiveTask' do include ArchiveTaskHelpers before(:each) do diff --git a/spec/packaging/packaging_helper.rb b/spec/packaging/packaging_helper.rb index d555d03ec..76f2247e5 100644 --- a/spec/packaging/packaging_helper.rb +++ b/spec/packaging/packaging_helper.rb @@ -14,7 +14,7 @@ # the License. -shared_examples_for 'packaging' do +RSpec.shared_examples 'packaging' do it 'should create artifact of proper type' do packaging = @packaging package_type = @package_type || @packaging diff --git a/spec/scala/compiler_spec.rb b/spec/scala/compiler_spec.rb index 509d567f4..3903581cc 100644 --- a/spec/scala/compiler_spec.rb +++ b/spec/scala/compiler_spec.rb @@ -17,7 +17,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers')) # need to test both with and without SCALA_HOME -share_as :ScalacCompiler do +RSpec.shared_examples 'ScalacCompiler' do it 'should identify itself from source directories' do write 'src/main/scala/com/example/Test.scala', 'package com.example; class Test { val i = 1 }' @@ -118,7 +118,7 @@ def define_test1_project ENV['SCALA_HOME'].should_not be_nil end - it_should_behave_like ScalacCompiler + it_should_behave_like 'ScalacCompiler' end end @@ -133,14 +133,14 @@ def define_test1_project ENV['SCALA_HOME'].should be_nil end - it_should_behave_like ScalacCompiler + it_should_behave_like 'ScalacCompiler' after :all do ENV['SCALA_HOME'] = old_home end end -share_as :ScalacCompiler_CommonOptions do +RSpec.shared_examples 'ScalacCompiler_CommonOptions' do it 'should set warnings option to false by default' do compile_task.options.warnings.should be_false @@ -275,7 +275,7 @@ def define_test1_project describe 'scala compiler 2.8 options' do - it_should_behave_like ScalacCompiler_CommonOptions + it_should_behave_like 'ScalacCompiler_CommonOptions' def compile_task @compile_task ||= define('foo').compile.using(:scalac) @@ -298,7 +298,7 @@ def scalac_args describe 'scala compiler 2.9 options' do - it_should_behave_like ScalacCompiler_CommonOptions + it_should_behave_like 'ScalacCompiler_CommonOptions' def compile_task @compile_task ||= define('foo').compile.using(:scalac) @@ -345,7 +345,7 @@ def javac_args compile_task.invoke end - it_should_behave_like ScalacCompiler + it_should_behave_like 'ScalacCompiler' after :each do Buildr.settings.build['scalac.incremental'] = nil