[DRE-commits] [rake-compiler] 02/04: Fix FTBFS for RSpec transition (Closes: #794147)

Youhei SASAKI uwabami-guest at moszumanska.debian.org
Sun Dec 27 13:56:32 UTC 2015


This is an automated email from the git hooks/post-receive script.

uwabami-guest pushed a commit to annotated tag debian/0.9.5-2
in repository rake-compiler.

commit a0f7bbafef80f5bdbbbc1392d40901521cef55a3
Author: Youhei SASAKI <uwabami at gfd-dennou.org>
Date:   Sun Dec 27 22:54:54 2015 +0900

    Fix FTBFS for RSpec transition (Closes: #794147)
    
    Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
---
 .../0002-Update-RSpec-ver.2-to-RSpec-ver.3.patch   | 876 +++++++++++++++++++++
 1 file changed, 876 insertions(+)

diff --git a/debian/patches/0002-Update-RSpec-ver.2-to-RSpec-ver.3.patch b/debian/patches/0002-Update-RSpec-ver.2-to-RSpec-ver.3.patch
new file mode 100644
index 0000000..f8161f1
--- /dev/null
+++ b/debian/patches/0002-Update-RSpec-ver.2-to-RSpec-ver.3.patch
@@ -0,0 +1,876 @@
+From: Youhei SASAKI <uwabami at gfd-dennou.org>
+Date: Sun, 27 Dec 2015 22:52:31 +0900
+Subject: Update RSpec ver.2 to RSpec ver.3
+
+Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
+---
+ features/step_definitions/compilation.rb       |   4 +-
+ features/step_definitions/cross_compilation.rb |   2 +-
+ features/step_definitions/execution.rb         |   4 +-
+ features/step_definitions/folders.rb           |   4 +-
+ features/step_definitions/gem.rb               |   8 +-
+ features/step_definitions/java_compilation.rb  |   4 +-
+ spec/lib/rake/extensiontask_spec.rb            | 192 ++++++++++++-------------
+ spec/lib/rake/javaextensiontask_spec.rb        |  64 ++++-----
+ 8 files changed, 141 insertions(+), 141 deletions(-)
+
+diff --git a/features/step_definitions/compilation.rb b/features/step_definitions/compilation.rb
+index bd4c3f6..8e857f3 100644
+--- a/features/step_definitions/compilation.rb
++++ b/features/step_definitions/compilation.rb
+@@ -63,8 +63,8 @@ end
+ Then /^binary extension '(.*)' (do|do not) exist in '(.*)'$/ do |extension_name, condition, folder|
+   ext_for_platform = File.join(folder, "#{extension_name}.#{RbConfig::CONFIG['DLEXT']}")
+   if condition == 'do'
+-    File.exist?(ext_for_platform).should be_true
++    File.exist?(ext_for_platform).should be_truthy
+   else
+-    File.exist?(ext_for_platform).should be_false
++    File.exist?(ext_for_platform).should be_falsey
+   end
+ end
+diff --git a/features/step_definitions/cross_compilation.rb b/features/step_definitions/cross_compilation.rb
+index 46242aa..48a8904 100644
+--- a/features/step_definitions/cross_compilation.rb
++++ b/features/step_definitions/cross_compilation.rb
+@@ -7,7 +7,7 @@ end
+ 
+ Given %r{^I've installed cross compile toolchain$} do
+   unless search_path(%w(i586-mingw32msvc-gcc i386-mingw32-gcc i686-w64-mingw32-gcc))
+-    pending 'Cannot locate suitable compiler in the PATH.'
++    skip 'Cannot locate suitable compiler in the PATH.'
+   end
+ end
+ 
+diff --git a/features/step_definitions/execution.rb b/features/step_definitions/execution.rb
+index a248dbc..ecc4502 100644
+--- a/features/step_definitions/execution.rb
++++ b/features/step_definitions/execution.rb
+@@ -27,7 +27,7 @@ Then /^rake task '(.*)' succeeded$/ do |task_name|
+   if @result.nil? || !@result.include?(task_name) then
+     raise "The task #{task_name} should be invoked first."
+   else
+-    @result[task_name].should be_true
++    @result[task_name].should be_truthy
+   end
+ end
+ 
+@@ -35,7 +35,7 @@ Then /^rake task '(.*)' should fail$/ do |task_name|
+   if @result.nil? || !@result.include?(task_name) then
+     raise "The task #{task_name} should be invoked first."
+   else
+-    @result[task_name].should be_false
++    @result[task_name].should be_falsey
+   end
+ end
+ 
+diff --git a/features/step_definitions/folders.rb b/features/step_definitions/folders.rb
+index 14990b7..baafefa 100644
+--- a/features/step_definitions/folders.rb
++++ b/features/step_definitions/folders.rb
+@@ -20,11 +20,11 @@ Given /^'(.*)' folder (exist|is deleted)$/ do |folder, condition|
+ end
+ 
+ Then /^'(.*)' folder is created$/ do |folder|
+-  File.directory?(folder).should be_true
++  File.directory?(folder).should be_truthy
+ end
+ 
+ Then /^'(.*)' folder do not exist$/ do |folder|
+-  File.directory?(folder).should_not be_true
++  File.directory?(folder).should_not be_truthy
+ end
+ 
+ Then /^no left over from '(.*)' remains in '(.*)'$/ do |name, folder|
+diff --git a/features/step_definitions/gem.rb b/features/step_definitions/gem.rb
+index 8989078..8281ed8 100644
+--- a/features/step_definitions/gem.rb
++++ b/features/step_definitions/gem.rb
+@@ -3,20 +3,20 @@ Given /^a gem named '(.*)'$/ do |gem_name|
+ end
+ 
+ Then /^ruby gem for '(.*)' version '(.*)' do exist in '(.*)'$/ do |name, version, folder|
+-  File.exist?(gem_file(folder, name, version)).should be_true
++  File.exist?(gem_file(folder, name, version)).should be_truthy
+ end
+ 
+ Then /^binary gem for '(.*)' version '(.*)' do exist in '(.*)'$/ do |name, version, folder|
+-  File.exist?(gem_file_platform(folder, name, version)).should be_true
++  File.exist?(gem_file_platform(folder, name, version)).should be_truthy
+ end
+ 
+ Then /^a gem for '(.*)' version '(.*)' platform '(.*)' do exist in '(.*)'$/ do |name, version, platform, folder|
+-  File.exist?(gem_file_platform(folder, name, version, platform)).should be_true
++  File.exist?(gem_file_platform(folder, name, version, platform)).should be_truthy
+ 
+   # unpack the Gem and check what's inside!
+   `gem unpack #{gem_file_platform(folder, name, version, platform)} --target tmp`
+   unpacked_gem_dir = unpacked_gem_dir_platform('tmp', name, version, platform)
+-  File.exist?(unpacked_gem_dir).should be_true
++  File.exist?(unpacked_gem_dir).should be_truthy
+ 
+   files = Dir.glob("#{unpacked_gem_dir}/lib/*.#{binary_extension(platform)}")
+   files << Dir.glob("#{unpacked_gem_dir}/lib/*/*.#{binary_extension(platform)}")
+diff --git a/features/step_definitions/java_compilation.rb b/features/step_definitions/java_compilation.rb
+index 16868b5..7e49edf 100644
+--- a/features/step_definitions/java_compilation.rb
++++ b/features/step_definitions/java_compilation.rb
+@@ -1,7 +1,7 @@
+ Given %r{^I've installed the Java Development Kit$} do
+-  pending('Cannot locate suitable Java compiler (the Java Development Kit) in the PATH.') unless search_path(%w(javac javac.exe))
++  skip('Cannot locate suitable Java compiler (the Java Development Kit) in the PATH.') unless search_path(%w(javac javac.exe))
+ end
+ 
+ Given %r{^I've installed JRuby$} do
+-  pending('Cannot locate a JRuby installation in the PATH.') unless search_path(%w(jruby jruby.exe jruby.bat))
++  skip('Cannot locate a JRuby installation in the PATH.') unless search_path(%w(jruby jruby.exe jruby.bat))
+ end
+diff --git a/spec/lib/rake/extensiontask_spec.rb b/spec/lib/rake/extensiontask_spec.rb
+index 575846a..3da945b 100644
+--- a/spec/lib/rake/extensiontask_spec.rb
++++ b/spec/lib/rake/extensiontask_spec.rb
+@@ -7,21 +7,21 @@ describe Rake::ExtensionTask do
+   context '#new' do
+     context '(basic)' do
+       it 'should raise an error if no name is provided' do
+-        lambda {
++        expect {
+           Rake::ExtensionTask.new
+-        }.should raise_error(RuntimeError, /Extension name must be provided/)
++        }.to raise_error(RuntimeError, /Extension name must be provided/)
+       end
+ 
+       it 'should allow string as extension name assignation' do
+         ext = Rake::ExtensionTask.new('extension_one')
+-        ext.name.should == 'extension_one'
++        expect(ext.name).to eq('extension_one')
+       end
+ 
+       it 'should allow string as extension name using block assignation' do
+         ext = Rake::ExtensionTask.new do |ext|
+           ext.name = 'extension_two'
+         end
+-        ext.name.should == 'extension_two'
++        expect(ext.name).to eq('extension_two')
+       end
+ 
+       it 'should return itself for the block' do
+@@ -29,13 +29,13 @@ describe Rake::ExtensionTask do
+         from_lasgn = Rake::ExtensionTask.new('extension_three') do |ext|
+           from_block = ext
+         end
+-        from_block.should == from_lasgn
++        expect(from_block).to eq(from_lasgn)
+       end
+ 
+       it 'should accept a gem specification as parameter' do
+         spec = mock_gem_spec
+         ext = Rake::ExtensionTask.new('extension_three', spec)
+-        ext.gem_spec.should == spec
++        expect(ext.gem_spec).to eq(spec)
+       end
+ 
+       it 'should allow gem specification be defined using block assignation' do
+@@ -43,14 +43,14 @@ describe Rake::ExtensionTask do
+         ext = Rake::ExtensionTask.new('extension_four') do |ext|
+           ext.gem_spec = spec
+         end
+-        ext.gem_spec.should == spec
++        expect(ext.gem_spec).to eq(spec)
+       end
+ 
+       it 'should allow forcing of platform' do
+         ext = Rake::ExtensionTask.new('weird_extension') do |ext|
+           ext.platform = 'universal-foo-bar-10.5'
+         end
+-        ext.platform.should == 'universal-foo-bar-10.5'
++        expect(ext.platform).to eq('universal-foo-bar-10.5')
+       end
+     end
+   end
+@@ -61,43 +61,43 @@ describe Rake::ExtensionTask do
+     end
+ 
+     it 'should look for extconf script' do
+-      @ext.config_script.should == 'extconf.rb'
++      expect(@ext.config_script).to eq('extconf.rb')
+     end
+ 
+     it 'should dump intermediate files to tmp/' do
+-      @ext.tmp_dir.should == 'tmp'
++      expect(@ext.tmp_dir).to eq('tmp')
+     end
+ 
+     it 'should copy build extension into lib/' do
+-      @ext.lib_dir.should == 'lib'
++      expect(@ext.lib_dir).to eq('lib')
+     end
+ 
+     it 'should look for C files pattern (.c)' do
+-      @ext.source_pattern.should == "*.c"
++      expect(@ext.source_pattern).to eq("*.c")
+     end
+ 
+     it 'should have no configuration options preset to delegate' do
+-      @ext.config_options.should be_empty
++      expect(@ext.config_options).to be_empty
+     end
+ 
+     it "should have no includes preset to delegate" do
+-      @ext.config_includes.should be_empty
++      expect(@ext.config_includes).to be_empty
+     end
+ 
+     it 'should default to current platform' do
+-      @ext.platform.should == RUBY_PLATFORM
++      expect(@ext.platform).to eq(RUBY_PLATFORM)
+     end
+ 
+     it 'should default to no cross compilation' do
+-      @ext.cross_compile.should be_false
++      expect(@ext.cross_compile).to be_falsey
+     end
+ 
+     it 'should have no configuration options for cross compilation' do
+-      @ext.cross_config_options.should be_empty
++      expect(@ext.cross_config_options).to be_empty
+     end
+ 
+     it "should have cross platform defined to 'i386-mingw32'" do
+-      @ext.cross_platform.should == 'i386-mingw32'
++      expect(@ext.cross_platform).to eq('i386-mingw32')
+     end
+   end
+ 
+@@ -110,7 +110,7 @@ describe Rake::ExtensionTask do
+ 
+     context '(one extension)' do
+       before :each do
+-        Rake::FileList.stub!(:[]).and_return(["ext/extension_one/source.c"], [])
++        allow(Rake::FileList).to receive(:[]).and_return(["ext/extension_one/source.c"], [])
+         @ext = Rake::ExtensionTask.new('extension_one')
+         @ext_bin = ext_bin('extension_one')
+         @platform = RUBY_PLATFORM
+@@ -119,97 +119,97 @@ describe Rake::ExtensionTask do
+ 
+       context 'compile' do
+         it 'should define as task' do
+-          Rake::Task.task_defined?('compile').should be_true
++          expect(Rake::Task.task_defined?('compile')).to be_truthy
+         end
+ 
+         it "should depend on 'compile:{platform}'" do
+-          Rake::Task['compile'].prerequisites.should include("compile:#{@platform}")
++          expect(Rake::Task['compile'].prerequisites).to include("compile:#{@platform}")
+         end
+       end
+ 
+       context 'compile:extension_one' do
+         it 'should define as task' do
+-          Rake::Task.task_defined?('compile:extension_one').should be_true
++          expect(Rake::Task.task_defined?('compile:extension_one')).to be_truthy
+         end
+ 
+         it "should depend on 'compile:extension_one:{platform}'" do
+-          Rake::Task['compile:extension_one'].prerequisites.should include("compile:extension_one:#{@platform}")
++          expect(Rake::Task['compile:extension_one'].prerequisites).to include("compile:extension_one:#{@platform}")
+         end
+       end
+ 
+       context 'lib/extension_one.{so,bundle}' do
+         it 'should define as task' do
+-          Rake::Task.task_defined?("lib/#{@ext_bin}").should be_true
++          expect(Rake::Task.task_defined?("lib/#{@ext_bin}")).to be_truthy
+         end
+ 
+         it "should depend on 'copy:extension_one:{platform}:{ruby_ver}'" do
+-          Rake::Task["lib/#{@ext_bin}"].prerequisites.should include("copy:extension_one:#{@platform}:#{@ruby_ver}")
++          expect(Rake::Task["lib/#{@ext_bin}"].prerequisites).to include("copy:extension_one:#{@platform}:#{@ruby_ver}")
+         end
+       end
+ 
+       context 'tmp/{platform}/extension_one/{ruby_ver}/extension_one.{so,bundle}' do
+         it 'should define as task' do
+-          Rake::Task.task_defined?("tmp/#{@platform}/extension_one/#{@ruby_ver}/#{@ext_bin}").should be_true
++          expect(Rake::Task.task_defined?("tmp/#{@platform}/extension_one/#{@ruby_ver}/#{@ext_bin}")).to be_truthy
+         end
+ 
+         it "should depend on 'tmp/{platform}/extension_one/{ruby_ver}/Makefile'" do
+-          Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/#{@ext_bin}"].prerequisites.should include("tmp/#{@platform}/extension_one/#{@ruby_ver}/Makefile")
++          expect(Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/#{@ext_bin}"].prerequisites).to include("tmp/#{@platform}/extension_one/#{@ruby_ver}/Makefile")
+         end
+ 
+         it "should depend on 'ext/extension_one/source.c'" do
+-          Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/#{@ext_bin}"].prerequisites.should include("ext/extension_one/source.c")
++          expect(Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/#{@ext_bin}"].prerequisites).to include("ext/extension_one/source.c")
+         end
+ 
+         it "should not depend on 'ext/extension_one/source.h'" do
+-          Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/#{@ext_bin}"].prerequisites.should_not include("ext/extension_one/source.h")
++          expect(Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/#{@ext_bin}"].prerequisites).not_to include("ext/extension_one/source.h")
+         end
+       end
+ 
+       context 'tmp/{platform}/extension_one/{ruby_ver}/Makefile' do
+         it 'should define as task' do
+-          Rake::Task.task_defined?("tmp/#{@platform}/extension_one/#{@ruby_ver}/Makefile").should be_true
++          expect(Rake::Task.task_defined?("tmp/#{@platform}/extension_one/#{@ruby_ver}/Makefile")).to be_truthy
+         end
+ 
+         it "should depend on 'tmp/{platform}/extension_one/{ruby_ver}'" do
+-          Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/Makefile"].prerequisites.should include("tmp/#{@platform}/extension_one/#{@ruby_ver}")
++          expect(Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/Makefile"].prerequisites).to include("tmp/#{@platform}/extension_one/#{@ruby_ver}")
+         end
+ 
+         it "should depend on 'ext/extension_one/extconf.rb'" do
+-          Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/Makefile"].prerequisites.should include("ext/extension_one/extconf.rb")
++          expect(Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/Makefile"].prerequisites).to include("ext/extension_one/extconf.rb")
+         end
+       end
+ 
+       context 'clean' do
+         it "should include 'tmp/{platform}/extension_one/{ruby_ver}' in the pattern" do
+-          CLEAN.should include("tmp/#{@platform}/extension_one/#{@ruby_ver}")
++          expect(CLEAN).to include("tmp/#{@platform}/extension_one/#{@ruby_ver}")
+         end
+       end
+ 
+       context 'clobber' do
+         it "should include 'lib/extension_one.{so,bundle}'" do
+-          CLOBBER.should include("lib/#{@ext_bin}")
++          expect(CLOBBER).to include("lib/#{@ext_bin}")
+         end
+ 
+         it "should include 'tmp'" do
+-          CLOBBER.should include('tmp')
++          expect(CLOBBER).to include('tmp')
+         end
+       end
+ 
+       it "should warn when pre-compiled files exist in extension directory" do
+-        Rake::FileList.stub!(:[]).
++        allow(Rake::FileList).to receive(:[]).
+           and_return(["ext/extension_one/source.c"],
+                       ["ext/extension_one/source.o"])
+ 
+         _, err = capture_output do
+           Rake::ExtensionTask.new('extension_one')
+         end
+-        err.should match(/rake-compiler found compiled files in 'ext\/extension_one' directory. Please remove them./)
++        expect(err).to match(/rake-compiler found compiled files in 'ext\/extension_one' directory. Please remove them./)
+       end
+     end
+ 
+     context '(extension in custom location)' do
+       before :each do
+-        Rake::FileList.stub!(:[]).and_return(["ext/extension_one/source.c"], [])
++        allow(Rake::FileList).to receive(:[]).and_return(["ext/extension_one/source.c"], [])
+         @ext = Rake::ExtensionTask.new('extension_one') do |ext|
+           ext.ext_dir = 'custom/ext/foo'
+         end
+@@ -220,14 +220,14 @@ describe Rake::ExtensionTask do
+ 
+       context 'tmp/{platform}/extension_one/{ruby_ver}/Makefile' do
+         it "should depend on 'custom/ext/foo/extconf.rb'" do
+-          Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/Makefile"].prerequisites.should include("custom/ext/foo/extconf.rb")
++          expect(Rake::Task["tmp/#{@platform}/extension_one/#{@ruby_ver}/Makefile"].prerequisites).to include("custom/ext/foo/extconf.rb")
+         end
+       end
+     end
+ 
+     context '(native tasks)' do
+       before :each do
+-        Rake::FileList.stub!(:[]).and_return(["ext/extension_one/source.c"], [])
++        allow(Rake::FileList).to receive(:[]).and_return(["ext/extension_one/source.c"], [])
+         @spec = mock_gem_spec
+         @ext_bin = ext_bin('extension_one')
+         @platform = RUBY_PLATFORM
+@@ -236,35 +236,35 @@ describe Rake::ExtensionTask do
+ 
+       context 'native' do
+         before :each do
+-          @spec.stub!(:platform=).and_return('ruby')
++          allow(@spec).to receive(:platform=).and_return('ruby')
+         end
+ 
+         it 'should define a task for building the supplied gem' do
+           Rake::ExtensionTask.new('extension_one', @spec)
+-          Rake::Task.task_defined?('native:my_gem').should be_true
++          expect(Rake::Task.task_defined?('native:my_gem')).to be_truthy
+         end
+ 
+         it 'should define as task for pure ruby gems' do
+-          Rake::Task.task_defined?('native').should be_false
++          expect(Rake::Task.task_defined?('native')).to be_falsey
+           Rake::ExtensionTask.new('extension_one', @spec)
+-          Rake::Task.task_defined?('native').should be_true
++          expect(Rake::Task.task_defined?('native')).to be_truthy
+         end
+ 
+         it 'should not define a task for already native gems' do
+-          @spec.stub!(:platform).and_return('current')
++          allow(@spec).to receive(:platform).and_return('current')
+           Rake::ExtensionTask.new('extension_one', @spec)
+-          Rake::Task.task_defined?('native').should be_false
++          expect(Rake::Task.task_defined?('native')).to be_falsey
+         end
+ 
+         it 'should depend on platform specific native tasks' do
+           Rake::ExtensionTask.new('extension_one', @spec)
+-          Rake::Task["native"].prerequisites.should include("native:#{@platform}")
++          expect(Rake::Task["native"].prerequisites).to include("native:#{@platform}")
+         end
+ 
+         context 'native:my_gem:{platform}' do
+           it 'should depend on binary extension' do
+             Rake::ExtensionTask.new('extension_one', @spec)
+-            Rake::Task["native:my_gem:#{@platform}"].prerequisites.should include("tmp/#{@platform}/stage/lib/#{@ext_bin}")
++            expect(Rake::Task["native:my_gem:#{@platform}"].prerequisites).to include("tmp/#{@platform}/stage/lib/#{@ext_bin}")
+           end
+         end
+       end
+@@ -272,21 +272,21 @@ describe Rake::ExtensionTask do
+ 
+     context '(cross platform tasks)' do
+       before :each do
+-        File.stub!(:exist?).and_return(true)
+-        YAML.stub!(:load_file).and_return(mock_config_yml)
+-        Rake::FileList.stub!(:[]).and_return(["ext/extension_one/source.c"], [])
++        allow(File).to receive(:exist?).and_return(true)
++        allow(YAML).to receive(:load_file).and_return(mock_config_yml)
++        allow(Rake::FileList).to receive(:[]).and_return(["ext/extension_one/source.c"], [])
+         @spec = mock_gem_spec
+         @config_file = File.expand_path("~/.rake-compiler/config.yml")
+         @ruby_ver = RUBY_VERSION
+         @platform = 'i386-mingw32'
+         @config_path = mock_config_yml["rbconfig-#{@platform}-#{@ruby_ver}"]
+ 
+-        File.stub!(:open).and_yield(mock_fake_rb)
++        allow(File).to receive(:open).and_yield(mock_fake_rb)
+       end
+ 
+       context 'if no rake-compiler configuration exists' do
+         before :each do
+-          File.should_receive(:exist?).with(@config_file).and_return(false)
++          expect(File).to receive(:exist?).with(@config_file).and_return(false)
+ 
+           _, @err = capture_output do
+             Rake::ExtensionTask.new('extension_one') do |ext|
+@@ -296,52 +296,52 @@ describe Rake::ExtensionTask do
+         end
+ 
+         it 'should not generate a warning' do
+-          @err.should eq("")
++          expect(@err).to eq("")
+         end
+ 
+         it 'should create a dummy nested cross-compile target that raises an error' do
+-          Rake::Task.should have_defined("cross")
++          expect(Rake::Task).to have_defined("cross")
+           Rake::Task["cross"].invoke
+-          lambda {
++          expect {
+             Rake::Task["compile"].invoke
+-          }.should raise_error(RuntimeError,
++          }.to raise_error(RuntimeError,
+                                /rake-compiler must be configured first to enable cross-compilation/)
+         end
+       end
+ 
+       it 'should parse the config file using YAML' do
+-        YAML.should_receive(:load_file).with(@config_file).and_return(mock_config_yml)
++        expect(YAML).to receive(:load_file).with(@config_file).and_return(mock_config_yml)
+         Rake::ExtensionTask.new('extension_one') do |ext|
+           ext.cross_compile = true
+         end
+       end
+ 
+       it 'should warn if no section of config file defines running version of ruby' do
+-        config = mock(Hash)
+-        config.should_receive(:[]).with("rbconfig-#{@platform}-#{@ruby_ver}").and_return(nil)
+-        YAML.stub!(:load_file).and_return(config)
++        config = double(Hash)
++        expect(config).to receive(:[]).with("rbconfig-#{@platform}-#{@ruby_ver}").and_return(nil)
++        allow(YAML).to receive(:load_file).and_return(config)
+         out, err = capture_output do
+           Rake::ExtensionTask.new('extension_one') do |ext|
+             ext.cross_compile = true
+           end
+         end
+-        err.should match(/no configuration section for specified version of Ruby/)
++        expect(err).to match(/no configuration section for specified version of Ruby/)
+       end
+ 
+       it 'should capture an action block to be executed when cross compiling' do
+-        lambda {
++        expect {
+           Rake::ExtensionTask.new('extension_one') do |ext|
+             ext.cross_compiling do |gem_spec|
+               gem_spec.post_install_message = "Cross compiled gem"
+             end
+           end
+-        }.should_not raise_error
++        }.not_to raise_error
+       end
+ 
+       it 'should generate additional rake tasks if files are added when cross compiling' do
+-        config = mock(Hash)
+-        config.stub!(:[]).and_return('/rubies/1.9.1/rbconfig.rb')
+-        YAML.stub!(:load_file).and_return(config)
++        config = double(Hash)
++        allow(config).to receive(:[]).and_return('/rubies/1.9.1/rbconfig.rb')
++        allow(YAML).to receive(:load_file).and_return(config)
+ 
+         # Use a real spec instead of a mock because define_native_tasks dups and
+         # calls methods on Gem::Specification, which is more than mock can do.
+@@ -364,14 +364,14 @@ describe Rake::ExtensionTask do
+           end
+         end
+         Rake::Task['native:my_gem:universal-unknown'].execute
+-        Rake::Task.should have_defined("tmp/universal-unknown/stage/somedir")
+-        Rake::Task.should have_defined("tmp/universal-unknown/stage/somedir/somefile")
++        expect(Rake::Task).to have_defined("tmp/universal-unknown/stage/somedir")
++        expect(Rake::Task).to have_defined("tmp/universal-unknown/stage/somedir/somefile")
+       end
+ 
+       it 'should allow usage of RUBY_CC_VERSION to indicate a different version of ruby' do
+-        config = mock(Hash)
+-        config.should_receive(:[]).with("rbconfig-i386-mingw32-1.9.1").and_return('/rubies/1.9.1/rbconfig.rb')
+-        YAML.stub!(:load_file).and_return(config)
++        config = double(Hash)
++        expect(config).to receive(:[]).with("rbconfig-i386-mingw32-1.9.1").and_return('/rubies/1.9.1/rbconfig.rb')
++        allow(YAML).to receive(:load_file).and_return(config)
+ 
+         ENV['RUBY_CC_VERSION'] = '1.9.1'
+         Rake::ExtensionTask.new('extension_one') do |ext|
+@@ -380,10 +380,10 @@ describe Rake::ExtensionTask do
+       end
+ 
+       it 'should allow multiple versions be supplied to RUBY_CC_VERSION' do
+-        config = mock(Hash)
+-        config.should_receive(:[]).once.with("rbconfig-i386-mingw32-1.8.6").and_return('/rubies/1.8.6/rbconfig.rb')
+-        config.should_receive(:[]).once.with("rbconfig-i386-mingw32-1.9.1").and_return('/rubies/1.9.1/rbconfig.rb')
+-        YAML.stub!(:load_file).and_return(config)
++        config = double(Hash)
++        expect(config).to receive(:[]).once.with("rbconfig-i386-mingw32-1.8.6").and_return('/rubies/1.8.6/rbconfig.rb')
++        expect(config).to receive(:[]).once.with("rbconfig-i386-mingw32-1.9.1").and_return('/rubies/1.9.1/rbconfig.rb')
++        allow(YAML).to receive(:load_file).and_return(config)
+ 
+         ENV['RUBY_CC_VERSION'] = '1.8.6:1.9.1'
+         Rake::ExtensionTask.new('extension_one') do |ext|
+@@ -397,9 +397,9 @@ describe Rake::ExtensionTask do
+ 
+       context "(cross compile for multiple versions)" do
+         before :each do
+-          config = mock(Hash)
+-          config.stub!(:[]).and_return('/rubies/1.8.6/rbconfig.rb', '/rubies/1.9.1/rbconfig.rb')
+-          YAML.stub!(:load_file).and_return(config)
++          config = double(Hash)
++          allow(config).to receive(:[]).and_return('/rubies/1.8.6/rbconfig.rb', '/rubies/1.9.1/rbconfig.rb')
++          allow(YAML).to receive(:load_file).and_return(config)
+ 
+           ENV['RUBY_CC_VERSION'] = '1.8.6:1.9.1'
+           @ext = Rake::ExtensionTask.new('extension_one') do |ext|
+@@ -409,8 +409,8 @@ describe Rake::ExtensionTask do
+         end
+ 
+         it 'should create specific copy of binaries for each version' do
+-          Rake::Task.should have_defined("copy:extension_one:universal-unknown:1.8.6")
+-          Rake::Task.should have_defined("copy:extension_one:universal-unknown:1.9.1")
++          expect(Rake::Task).to have_defined("copy:extension_one:universal-unknown:1.8.6")
++          expect(Rake::Task).to have_defined("copy:extension_one:universal-unknown:1.9.1")
+         end
+       end
+ 
+@@ -424,48 +424,48 @@ describe Rake::ExtensionTask do
+ 
+         context 'fake' do
+           it 'should chain fake task to Makefile generation' do
+-            Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/Makefile"].prerequisites.should include("tmp/universal-unknown/extension_one/#{@ruby_ver}/fake.rb")
++            expect(Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/Makefile"].prerequisites).to include("tmp/universal-unknown/extension_one/#{@ruby_ver}/fake.rb")
+           end
+         end
+ 
+         context 'rbconfig' do
+           it 'should chain rbconfig tasks to Makefile generation' do
+-            Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/Makefile"].prerequisites.should include("tmp/universal-unknown/extension_one/#{@ruby_ver}/rbconfig.rb")
++            expect(Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/Makefile"].prerequisites).to include("tmp/universal-unknown/extension_one/#{@ruby_ver}/rbconfig.rb")
+           end
+ 
+           it 'should take rbconfig from rake-compiler configuration' do
+-            Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/rbconfig.rb"].prerequisites.should include(@config_path)
++            expect(Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/rbconfig.rb"].prerequisites).to include(@config_path)
+           end
+         end
+ 
+         context 'mkmf' do
+           it 'should chain mkmf tasks to Makefile generation' do
+-            Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/Makefile"].prerequisites.should include("tmp/universal-unknown/extension_one/#{@ruby_ver}/mkmf.rb")
++            expect(Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/Makefile"].prerequisites).to include("tmp/universal-unknown/extension_one/#{@ruby_ver}/mkmf.rb")
+           end
+ 
+           it 'should take mkmf from rake-compiler configuration' do
+             mkmf_path = File.expand_path(File.join(File.dirname(@config_path), '..', 'mkmf.rb'))
+-            Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/mkmf.rb"].prerequisites.should include(mkmf_path)
++            expect(Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/mkmf.rb"].prerequisites).to include(mkmf_path)
+           end
+         end
+ 
+         context 'compile:universal-unknown' do
+           it "should be defined" do
+-            Rake::Task.task_defined?('compile:universal-unknown').should be_true
++            expect(Rake::Task.task_defined?('compile:universal-unknown')).to be_truthy
+           end
+ 
+           it "should depend on 'compile:extension_one:universal-unknown'" do
+-            Rake::Task['compile:universal-unknown'].prerequisites.should include('compile:extension_one:universal-unknown')
++            expect(Rake::Task['compile:universal-unknown'].prerequisites).to include('compile:extension_one:universal-unknown')
+           end
+         end
+ 
+         context 'native:universal-unknown' do
+           it "should be defined" do
+-            Rake::Task.task_defined?('native:universal-unknown').should be_true
++            expect(Rake::Task.task_defined?('native:universal-unknown')).to be_truthy
+           end
+ 
+           it "should depend on 'native:my_gem:universal-unknown'" do
+-            Rake::Task['native:universal-unknown'].prerequisites.should include('native:my_gem:universal-unknown')
++            expect(Rake::Task['native:universal-unknown'].prerequisites).to include('native:my_gem:universal-unknown')
+           end
+         end
+       end
+@@ -481,13 +481,13 @@ describe Rake::ExtensionTask do
+         end
+ 
+         it 'should define task for each supplied platform' do
+-          Rake::Task.should have_defined('compile:universal-known')
+-          Rake::Task.should have_defined('compile:universal-unknown')
++          expect(Rake::Task).to have_defined('compile:universal-known')
++          expect(Rake::Task).to have_defined('compile:universal-unknown')
+         end
+ 
+         it 'should filter options for each supplied platform' do
+-          @ext.cross_config_options('universal-unknown').should eq(%w[--with-something])
+-          @ext.cross_config_options('universal-known').should eq(%w[--with-something --with-known])
++          expect(@ext.cross_config_options('universal-unknown')).to eq(%w[--with-something])
++          expect(@ext.cross_config_options('universal-known')).to eq(%w[--with-something --with-known])
+         end
+       end
+     end
+@@ -499,7 +499,7 @@ describe Rake::ExtensionTask do
+   end
+ 
+   def mock_gem_spec(stubs = {})
+-    mock(Gem::Specification,
++    double(Gem::Specification,
+       { :name => 'my_gem', :platform => 'ruby', :files => [] }.merge(stubs)
+     )
+   end
+@@ -536,6 +536,6 @@ describe Rake::ExtensionTask do
+   end
+ 
+   def mock_fake_rb
+-    mock(File, :write => 45)
++    double(File, :write => 45)
+   end
+ end
+diff --git a/spec/lib/rake/javaextensiontask_spec.rb b/spec/lib/rake/javaextensiontask_spec.rb
+index 824b0b7..9806453 100644
+--- a/spec/lib/rake/javaextensiontask_spec.rb
++++ b/spec/lib/rake/javaextensiontask_spec.rb
+@@ -7,21 +7,21 @@ describe Rake::JavaExtensionTask do
+   context '#new' do
+     context '(basic)' do
+       it 'should raise an error if no name is provided' do
+-        lambda {
++        expect {
+           Rake::JavaExtensionTask.new
+-        }.should raise_error(RuntimeError, /Extension name must be provided/)
++        }.to raise_error(RuntimeError, /Extension name must be provided/)
+       end
+ 
+       it 'should allow string as extension name assignation' do
+         ext = Rake::JavaExtensionTask.new('extension_one')
+-        ext.name.should == 'extension_one'
++        expect(ext.name).to eq('extension_one')
+       end
+ 
+       it 'should allow string as extension name using block assignation' do
+         ext = Rake::JavaExtensionTask.new do |ext|
+           ext.name = 'extension_two'
+         end
+-        ext.name.should == 'extension_two'
++        expect(ext.name).to eq('extension_two')
+       end
+ 
+       it 'should return itself for the block' do
+@@ -29,13 +29,13 @@ describe Rake::JavaExtensionTask do
+         from_lasgn = Rake::JavaExtensionTask.new('extension_three') do |ext|
+           from_block = ext
+         end
+-        from_block.should == from_lasgn
++        expect(from_block).to eq(from_lasgn)
+       end
+ 
+       it 'should accept a gem specification as parameter' do
+         spec = mock_gem_spec
+         ext = Rake::JavaExtensionTask.new('extension_three', spec)
+-        ext.gem_spec.should == spec
++        expect(ext.gem_spec).to eq(spec)
+       end
+ 
+       it 'should allow gem specification be defined using block assignation' do
+@@ -43,14 +43,14 @@ describe Rake::JavaExtensionTask do
+         ext = Rake::JavaExtensionTask.new('extension_four') do |ext|
+           ext.gem_spec = spec
+         end
+-        ext.gem_spec.should == spec
++        expect(ext.gem_spec).to eq(spec)
+       end
+ 
+       it 'should allow forcing of platform' do
+         ext = Rake::JavaExtensionTask.new('weird_extension') do |ext|
+           ext.platform = 'java-128bit'
+         end
+-        ext.platform.should == 'java-128bit'
++        expect(ext.platform).to eq('java-128bit')
+       end
+     end
+   end
+@@ -61,23 +61,23 @@ describe Rake::JavaExtensionTask do
+     end
+ 
+     it 'should dump intermediate files to tmp/' do
+-      @ext.tmp_dir.should == 'tmp'
++      expect(@ext.tmp_dir).to eq('tmp')
+     end
+ 
+     it 'should copy build extension into lib/' do
+-      @ext.lib_dir.should == 'lib'
++      expect(@ext.lib_dir).to eq('lib')
+     end
+ 
+     it 'should look for Java files pattern (.java)' do
+-      @ext.source_pattern.should == "**/*.java"
++      expect(@ext.source_pattern).to eq("**/*.java")
+     end
+ 
+     it 'should have no configuration options preset to delegate' do
+-      @ext.config_options.should be_empty
++      expect(@ext.config_options).to be_empty
+     end
+ 
+     it 'should default to Java platform' do
+-      @ext.platform.should == 'java'
++      expect(@ext.platform).to eq('java')
+     end
+ 
+   context '(tasks)' do
+@@ -89,7 +89,7 @@ describe Rake::JavaExtensionTask do
+ 
+     context '(one extension)' do
+       before :each do
+-        Rake::FileList.stub!(:[]).and_return(["ext/extension_one/source.java"])
++        allow(Rake::FileList).to receive(:[]).and_return(["ext/extension_one/source.java"])
+         @ext = Rake::JavaExtensionTask.new('extension_one')
+         @ext_bin = ext_bin('extension_one')
+         @platform = 'java'
+@@ -97,71 +97,71 @@ describe Rake::JavaExtensionTask do
+ 
+       context 'compile' do
+         it 'should define as task' do
+-          Rake::Task.task_defined?('compile').should be_true
++          expect(Rake::Task.task_defined?('compile')).to be_truthy
+         end
+ 
+         it "should depend on 'compile:{platform}'" do
+-          pending 'needs fixing'
+-          Rake::Task['compile'].prerequisites.should include("compile:#{@platform}")
++          skip 'needs fixing'
++          expect(Rake::Task['compile'].prerequisites).to include("compile:#{@platform}")
+         end
+       end
+ 
+       context 'compile:extension_one' do
+         it 'should define as task' do
+-          Rake::Task.task_defined?('compile:extension_one').should be_true
++          expect(Rake::Task.task_defined?('compile:extension_one')).to be_truthy
+         end
+ 
+         it "should depend on 'compile:extension_one:{platform}'" do
+-          pending 'needs fixing'
+-          Rake::Task['compile:extension_one'].prerequisites.should include("compile:extension_one:#{@platform}")
++          skip 'needs fixing'
++          expect(Rake::Task['compile:extension_one'].prerequisites).to include("compile:extension_one:#{@platform}")
+         end
+       end
+ 
+       context 'lib/extension_one.jar' do
+         it 'should define as task' do
+-          pending 'needs fixing'
+-          Rake::Task.task_defined?("lib/#{@ext_bin}").should be_true
++          skip 'needs fixing'
++          expect(Rake::Task.task_defined?("lib/#{@ext_bin}")).to be_truthy
+         end
+ 
+         it "should depend on 'copy:extension_one:{platform}'" do
+-          pending 'needs fixing'
+-          Rake::Task["lib/#{@ext_bin}"].prerequisites.should include("copy:extension_one:#{@platform}")
++          skip 'needs fixing'
++          expect(Rake::Task["lib/#{@ext_bin}"].prerequisites).to include("copy:extension_one:#{@platform}")
+         end
+       end
+ 
+       context 'tmp/{platform}/extension_one/extension_one.jar' do
+         it 'should define as task' do
+-          Rake::Task.task_defined?("tmp/#{@platform}/extension_one/#{@ext_bin}").should be_true
++          expect(Rake::Task.task_defined?("tmp/#{@platform}/extension_one/#{@ext_bin}")).to be_truthy
+         end
+ 
+         it "should depend on checkpoint file" do
+-          Rake::Task["tmp/#{@platform}/extension_one/#{@ext_bin}"].prerequisites.should include("tmp/#{@platform}/extension_one/.build")
++          expect(Rake::Task["tmp/#{@platform}/extension_one/#{@ext_bin}"].prerequisites).to include("tmp/#{@platform}/extension_one/.build")
+         end
+       end
+ 
+       context 'tmp/{platform}/extension_one/.build' do
+         it 'should define as task' do
+-          Rake::Task.task_defined?("tmp/#{@platform}/extension_one/.build").should be_true
++          expect(Rake::Task.task_defined?("tmp/#{@platform}/extension_one/.build")).to be_truthy
+         end
+ 
+         it 'should depend on source files' do
+-          Rake::Task["tmp/#{@platform}/extension_one/.build"].prerequisites.should include("ext/extension_one/source.java")
++          expect(Rake::Task["tmp/#{@platform}/extension_one/.build"].prerequisites).to include("ext/extension_one/source.java")
+         end
+       end
+ 
+       context 'clean' do
+         it "should include 'tmp/{platform}/extension_one' in the pattern" do
+-          CLEAN.should include("tmp/#{@platform}/extension_one")
++          expect(CLEAN).to include("tmp/#{@platform}/extension_one")
+         end
+       end
+ 
+       context 'clobber' do
+         it "should include 'lib/extension_one.jar'" do
+-          CLOBBER.should include("lib/#{@ext_bin}")
++          expect(CLOBBER).to include("lib/#{@ext_bin}")
+         end
+ 
+         it "should include 'tmp'" do
+-          CLOBBER.should include('tmp')
++          expect(CLOBBER).to include('tmp')
+         end
+       end
+     end
+@@ -174,7 +174,7 @@ describe Rake::JavaExtensionTask do
+   end
+ 
+   def mock_gem_spec(stubs = {})
+-    mock(Gem::Specification,
++    double(Gem::Specification,
+       { :name => 'my_gem', :platform => 'ruby' }.merge(stubs)
+     )
+   end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/rake-compiler.git



More information about the Pkg-ruby-extras-commits mailing list