[DRE-commits] [ruby-foreman] 01/02: port to RSpec 3, and drop usage of `rr`

Antonio Terceiro terceiro at moszumanska.debian.org
Wed Nov 2 22:06:16 UTC 2016


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

terceiro pushed a commit to branch master
in repository ruby-foreman.

commit e12303fc3fb364a6bb9317cb529be150ecb0c505
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Wed Nov 2 19:32:29 2016 -0200

    port to RSpec 3, and drop usage of `rr`
---
 debian/changelog                                   |   8 +
 .../0001-Look-for-data-in-usr-share-foreman.patch  |   8 +-
 ...-misc-changes-to-run-against-Debian-packa.patch |   6 +-
 debian/patches/0004-port-to-rspec-3.patch          | 412 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 5 files changed, 430 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1564686..fd4d7d4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+ruby-foreman (0.82.0-2) UNRELEASED; urgency=medium
+
+  * Add patch 0004-port-to-rspec-3.patch to port to RSpec 3, and drop usage of
+    `rr` which is causing problems in the test suite after `rr` 1.2 was
+    uploaded. (Closes: #840690)
+
+ -- Antonio Terceiro <terceiro at debian.org>  Wed, 02 Nov 2016 19:31:14 -0200
+
 ruby-foreman (0.82.0-1) unstable; urgency=medium
 
   [ Cédric Boutillier ]
diff --git a/debian/patches/0001-Look-for-data-in-usr-share-foreman.patch b/debian/patches/0001-Look-for-data-in-usr-share-foreman.patch
index df4ee59..0417c2d 100644
--- a/debian/patches/0001-Look-for-data-in-usr-share-foreman.patch
+++ b/debian/patches/0001-Look-for-data-in-usr-share-foreman.patch
@@ -6,9 +6,11 @@ Subject: Look for data in /usr/share/foreman
  lib/foreman/export/base.rb | 13 +++++++++++--
  1 file changed, 11 insertions(+), 2 deletions(-)
 
+diff --git a/lib/foreman/export/base.rb b/lib/foreman/export/base.rb
+index a5e528b..1e78fbf 100644
 --- a/lib/foreman/export/base.rb
 +++ b/lib/foreman/export/base.rb
-@@ -117,7 +117,7 @@ private ################################
+@@ -117,7 +117,7 @@ private ######################################################################
      elsif File.exist?(file_path = File.expand_path(File.join("~/.foreman/templates", file)))
        File.read(file_path)
      else
@@ -17,7 +19,7 @@ Subject: Look for data in /usr/share/foreman
      end
    end
  
-@@ -129,7 +129,7 @@ private ################################
+@@ -129,7 +129,7 @@ private ######################################################################
        matchers = []
        matchers << File.join(options[:template], name_without_first) if options[:template]
        matchers << File.expand_path("~/.foreman/templates/#{name}")
@@ -26,7 +28,7 @@ Subject: Look for data in /usr/share/foreman
        File.read(matchers.detect { |m| File.exists?(m) })
      end
    end
-@@ -164,4 +164,13 @@ private ################################
+@@ -164,4 +164,13 @@ private ######################################################################
      end
    end
  
diff --git a/debian/patches/0003-spec_helper-misc-changes-to-run-against-Debian-packa.patch b/debian/patches/0003-spec_helper-misc-changes-to-run-against-Debian-packa.patch
index 9c66635..a84133d 100644
--- a/debian/patches/0003-spec_helper-misc-changes-to-run-against-Debian-packa.patch
+++ b/debian/patches/0003-spec_helper-misc-changes-to-run-against-Debian-packa.patch
@@ -3,9 +3,11 @@ Date: Wed, 4 Feb 2015 11:31:10 -0200
 Subject: spec_helper: misc changes to run against Debian packages
 
 ---
- spec/spec_helper.rb | 15 +++++----------
- 1 file changed, 5 insertions(+), 10 deletions(-)
+ spec/spec_helper.rb | 20 +++++++++-----------
+ 1 file changed, 9 insertions(+), 11 deletions(-)
 
+diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
+index 2eaca35..ef08802 100644
 --- a/spec/spec_helper.rb
 +++ b/spec/spec_helper.rb
 @@ -1,17 +1,11 @@
diff --git a/debian/patches/0004-port-to-rspec-3.patch b/debian/patches/0004-port-to-rspec-3.patch
new file mode 100644
index 0000000..9bf4aa0
--- /dev/null
+++ b/debian/patches/0004-port-to-rspec-3.patch
@@ -0,0 +1,412 @@
+From: Antonio Terceiro <terceiro at softwarelivre.org>
+Date: Wed, 2 Nov 2016 14:18:32 -0200
+Subject: port to rspec 3
+
+Submitted upstream at https://github.com/ddollar/foreman/pull/649
+
+---
+ spec/foreman/cli_spec.rb                |  2 +-
+ spec/foreman/engine_spec.rb             | 16 ++++++------
+ spec/foreman/export/base_spec.rb        |  2 +-
+ spec/foreman/export/bluepill_spec.rb    |  4 +--
+ spec/foreman/export/daemon_spec.rb      | 22 ++++++++---------
+ spec/foreman/export/inittab_spec.rb     |  4 +--
+ spec/foreman/export/launchd_spec.rb     |  2 +-
+ spec/foreman/export/runit_spec.rb       |  4 +--
+ spec/foreman/export/supervisord_spec.rb |  4 +--
+ spec/foreman/export/systemd_spec.rb     | 44 ++++++++++++++++-----------------
+ spec/foreman/export/upstart_spec.rb     | 24 +++++++++---------
+ spec/foreman/export_spec.rb             |  2 +-
+ spec/foreman/process_spec.rb            |  4 +--
+ spec/foreman_spec.rb                    |  2 +-
+ spec/spec_helper.rb                     |  4 +--
+ 15 files changed, 69 insertions(+), 71 deletions(-)
+
+diff --git a/spec/foreman/cli_spec.rb b/spec/foreman/cli_spec.rb
+index 4348125..b8c3cfe 100644
+--- a/spec/foreman/cli_spec.rb
++++ b/spec/foreman/cli_spec.rb
+@@ -21,7 +21,7 @@ describe "Foreman::CLI", :fakefs do
+     describe "when a Procfile doesnt exist", :fakefs do
+       it "displays an error" do
+         mock_error(subject, "Procfile does not exist.") do
+-          dont_allow.instance_of(Foreman::Engine).start
++          expect_any_instance_of(Foreman::Engine).to_not receive(:start)
+           subject.start
+         end
+       end
+diff --git a/spec/foreman/engine_spec.rb b/spec/foreman/engine_spec.rb
+index 03bd084..060b963 100644
+--- a/spec/foreman/engine_spec.rb
++++ b/spec/foreman/engine_spec.rb
+@@ -35,19 +35,19 @@ describe "Foreman::Engine", :fakefs do
+ 
+   describe "start" do
+     it "forks the processes" do
+-      mock(subject.process("alpha")).run(anything)
+-      mock(subject.process("bravo")).run(anything)
+-      mock(subject).watch_for_output
+-      mock(subject).wait_for_shutdown_or_child_termination
++      expect(subject.process("alpha")).to receive(:run)
++      expect(subject.process("bravo")).to receive(:run)
++      expect(subject).to receive(:watch_for_output)
++      expect(subject).to receive(:wait_for_shutdown_or_child_termination)
+       subject.start
+     end
+ 
+     it "handles concurrency" do
+       subject.options[:formation] = "alpha=2"
+-      mock(subject.process("alpha")).run(anything).twice
+-      mock(subject.process("bravo")).run(anything).never
+-      mock(subject).watch_for_output
+-      mock(subject).wait_for_shutdown_or_child_termination
++      expect(subject.process("alpha")).to receive(:run).twice
++      expect(subject.process("bravo")).to_not receive(:run)
++      expect(subject).to receive(:watch_for_output)
++      expect(subject).to receive(:wait_for_shutdown_or_child_termination)
+       subject.start
+     end
+   end
+diff --git a/spec/foreman/export/base_spec.rb b/spec/foreman/export/base_spec.rb
+index 2a465d0..3add296 100644
+--- a/spec/foreman/export/base_spec.rb
++++ b/spec/foreman/export/base_spec.rb
+@@ -9,7 +9,7 @@ describe "Foreman::Export::Base", :fakefs do
+   let(:subject)  { Foreman::Export::Base.new(location, engine) }
+ 
+   it "has a say method for displaying info" do
+-    mock(subject).puts("[foreman export] foo")
++    expect(subject).to receive(:puts).with("[foreman export] foo")
+     subject.send(:say, "foo")
+   end
+ 
+diff --git a/spec/foreman/export/bluepill_spec.rb b/spec/foreman/export/bluepill_spec.rb
+index f1c15e9..284226a 100644
+--- a/spec/foreman/export/bluepill_spec.rb
++++ b/spec/foreman/export/bluepill_spec.rb
+@@ -11,7 +11,7 @@ describe Foreman::Export::Bluepill, :fakefs do
+   let(:bluepill)  { Foreman::Export::Bluepill.new("/tmp/init", engine, options) }
+ 
+   before(:each) { load_export_templates_into_fakefs("bluepill") }
+-  before(:each) { stub(bluepill).say }
++  before(:each) { allow(bluepill).to receive(:say) }
+ 
+   it "exports to the filesystem" do
+     bluepill.export
+@@ -19,7 +19,7 @@ describe Foreman::Export::Bluepill, :fakefs do
+   end
+ 
+   it "cleans up if exporting into an existing dir" do
+-    mock(FileUtils).rm("/tmp/init/app.pill")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app.pill")
+ 
+     bluepill.export
+     bluepill.export
+diff --git a/spec/foreman/export/daemon_spec.rb b/spec/foreman/export/daemon_spec.rb
+index c163c96..fe40dd2 100644
+--- a/spec/foreman/export/daemon_spec.rb
++++ b/spec/foreman/export/daemon_spec.rb
+@@ -11,7 +11,7 @@ describe Foreman::Export::Daemon, :fakefs do
+   let(:daemon)   { Foreman::Export::Daemon.new("/tmp/init", engine, options) }
+ 
+   before(:each) { load_export_templates_into_fakefs("daemon") }
+-  before(:each) { stub(daemon).say }
++  before(:each) { allow(daemon).to receive(:say) }
+ 
+   it "exports to the filesystem" do
+     daemon.export
+@@ -24,15 +24,15 @@ describe Foreman::Export::Daemon, :fakefs do
+   end
+ 
+   it "cleans up if exporting into an existing dir" do
+-    mock(FileUtils).rm("/tmp/init/app.conf")
+-    mock(FileUtils).rm("/tmp/init/app-alpha.conf")
+-    mock(FileUtils).rm("/tmp/init/app-alpha-1.conf")
+-    mock(FileUtils).rm("/tmp/init/app-bravo.conf")
+-    mock(FileUtils).rm("/tmp/init/app-bravo-1.conf")
+-    mock(FileUtils).rm("/tmp/init/app-foo-bar.conf")
+-    mock(FileUtils).rm("/tmp/init/app-foo-bar-1.conf")
+-    mock(FileUtils).rm("/tmp/init/app-foo_bar.conf")
+-    mock(FileUtils).rm("/tmp/init/app-foo_bar-1.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-alpha.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-alpha-1.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-bravo.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-bravo-1.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-foo-bar.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-foo-bar-1.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-foo_bar.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-foo_bar-1.conf")
+ 
+     daemon.export
+     daemon.export
+@@ -44,7 +44,7 @@ describe Foreman::Export::Daemon, :fakefs do
+     ["app2", "app2-alpha", "app2-alpha-1"].each do |name|
+       path = "/tmp/init/#{name}.conf"
+       FileUtils.touch(path)
+-      dont_allow(FileUtils).rm(path)
++      expect(FileUtils).to_not receive(:rm).with(path)
+     end
+ 
+     daemon.export
+diff --git a/spec/foreman/export/inittab_spec.rb b/spec/foreman/export/inittab_spec.rb
+index 98382d1..c097550 100644
+--- a/spec/foreman/export/inittab_spec.rb
++++ b/spec/foreman/export/inittab_spec.rb
+@@ -12,7 +12,7 @@ describe Foreman::Export::Inittab, :fakefs do
+   let(:inittab)   { Foreman::Export::Inittab.new(location, engine, options) }
+ 
+   before(:each) { load_export_templates_into_fakefs("inittab") }
+-  before(:each) { stub(inittab).say }
++  before(:each) { allow(inittab).to receive(:say) }
+ 
+   it "exports to the filesystem" do
+     inittab.export
+@@ -23,7 +23,7 @@ describe Foreman::Export::Inittab, :fakefs do
+     let(:location) { "-" }
+ 
+     it "exports to stdout" do
+-      mock(inittab).puts example_export_file("inittab/inittab.default")
++      expect(inittab).to receive(:puts).with(example_export_file("inittab/inittab.default"))
+       inittab.export
+     end
+   end
+diff --git a/spec/foreman/export/launchd_spec.rb b/spec/foreman/export/launchd_spec.rb
+index f42d025..ee6c663 100644
+--- a/spec/foreman/export/launchd_spec.rb
++++ b/spec/foreman/export/launchd_spec.rb
+@@ -10,7 +10,7 @@ describe Foreman::Export::Launchd, :fakefs do
+   let(:launchd)  { Foreman::Export::Launchd.new("/tmp/init", engine, options) }
+ 
+   before(:each) { load_export_templates_into_fakefs("launchd") }
+-  before(:each) { stub(launchd).say }
++  before(:each) { allow(launchd).to receive(:say) }
+ 
+   it "exports to the filesystem" do
+     launchd.export
+diff --git a/spec/foreman/export/runit_spec.rb b/spec/foreman/export/runit_spec.rb
+index 586d4fc..5fa12fa 100644
+--- a/spec/foreman/export/runit_spec.rb
++++ b/spec/foreman/export/runit_spec.rb
+@@ -10,8 +10,8 @@ describe Foreman::Export::Runit, :fakefs do
+   let(:runit)    { Foreman::Export::Runit.new('/tmp/init', engine, options) }
+ 
+   before(:each) { load_export_templates_into_fakefs("runit") }
+-  before(:each) { stub(runit).say }
+-  before(:each) { stub(FakeFS::FileUtils).chmod }
++  before(:each) { allow(runit).to receive(:say) }
++  before(:each) { allow(FakeFS::FileUtils).to receive(:chmod) }
+ 
+   it "exports to the filesystem" do
+     engine.env["BAR"] = "baz"
+diff --git a/spec/foreman/export/supervisord_spec.rb b/spec/foreman/export/supervisord_spec.rb
+index 6c32b81..3335508 100644
+--- a/spec/foreman/export/supervisord_spec.rb
++++ b/spec/foreman/export/supervisord_spec.rb
+@@ -11,7 +11,7 @@ describe Foreman::Export::Supervisord, :fakefs do
+   let(:supervisord) { Foreman::Export::Supervisord.new("/tmp/init", engine, options) }
+ 
+   before(:each) { load_export_templates_into_fakefs("supervisord") }
+-  before(:each) { stub(supervisord).say }
++  before(:each) { allow(supervisord).to receive(:say) }
+ 
+   it "exports to the filesystem" do
+     write_env(".env", "FOO"=>"bar", "URL"=>"http://example.com/api?foo=bar&baz=1")
+@@ -21,7 +21,7 @@ describe Foreman::Export::Supervisord, :fakefs do
+   end
+ 
+   it "cleans up if exporting into an existing dir" do
+-    mock(FileUtils).rm("/tmp/init/app.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app.conf")
+     supervisord.export
+     supervisord.export
+   end
+diff --git a/spec/foreman/export/systemd_spec.rb b/spec/foreman/export/systemd_spec.rb
+index f9131b8..ea01605 100644
+--- a/spec/foreman/export/systemd_spec.rb
++++ b/spec/foreman/export/systemd_spec.rb
+@@ -11,7 +11,7 @@ describe Foreman::Export::Systemd, :fakefs do
+   let(:systemd)   { Foreman::Export::Systemd.new("/tmp/init", engine, options) }
+ 
+   before(:each) { load_export_templates_into_fakefs("systemd") }
+-  before(:each) { stub(systemd).say }
++  before(:each) { allow(systemd).to receive(:say) }
+ 
+   it "exports to the filesystem" do
+     systemd.export
+@@ -27,27 +27,27 @@ describe Foreman::Export::Systemd, :fakefs do
+   end
+ 
+   it "cleans up if exporting into an existing dir" do
+-    mock(FileUtils).rm("/tmp/init/app.target")
+-
+-    mock(FileUtils).rm("/tmp/init/app-alpha at .service")
+-    mock(FileUtils).rm("/tmp/init/app-alpha.target")
+-    mock(FileUtils).rm("/tmp/init/app-alpha.target.wants/app-alpha at 5000.service")
+-    mock(FileUtils).rm_r("/tmp/init/app-alpha.target.wants")
+-
+-    mock(FileUtils).rm("/tmp/init/app-bravo.target")
+-    mock(FileUtils).rm("/tmp/init/app-bravo at .service")
+-    mock(FileUtils).rm("/tmp/init/app-bravo.target.wants/app-bravo at 5100.service")
+-    mock(FileUtils).rm_r("/tmp/init/app-bravo.target.wants")
+-
+-    mock(FileUtils).rm("/tmp/init/app-foo_bar.target")
+-    mock(FileUtils).rm("/tmp/init/app-foo_bar at .service")
+-    mock(FileUtils).rm("/tmp/init/app-foo_bar.target.wants/app-foo_bar at 5200.service")
+-    mock(FileUtils).rm_r("/tmp/init/app-foo_bar.target.wants")
+-
+-    mock(FileUtils).rm("/tmp/init/app-foo-bar.target")
+-    mock(FileUtils).rm("/tmp/init/app-foo-bar at .service")
+-    mock(FileUtils).rm("/tmp/init/app-foo-bar.target.wants/app-foo-bar at 5300.service")
+-    mock(FileUtils).rm_r("/tmp/init/app-foo-bar.target.wants")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app.target")
++
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-alpha at .service")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-alpha.target")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-alpha.target.wants/app-alpha at 5000.service")
++    expect(FileUtils).to receive(:rm_r).with("/tmp/init/app-alpha.target.wants")
++
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-bravo.target")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-bravo at .service")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-bravo.target.wants/app-bravo at 5100.service")
++    expect(FileUtils).to receive(:rm_r).with("/tmp/init/app-bravo.target.wants")
++
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-foo_bar.target")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-foo_bar at .service")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-foo_bar.target.wants/app-foo_bar at 5200.service")
++    expect(FileUtils).to receive(:rm_r).with("/tmp/init/app-foo_bar.target.wants")
++
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-foo-bar.target")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-foo-bar at .service")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-foo-bar.target.wants/app-foo-bar at 5300.service")
++    expect(FileUtils).to receive(:rm_r).with("/tmp/init/app-foo-bar.target.wants")
+ 
+ 
+     systemd.export
+diff --git a/spec/foreman/export/upstart_spec.rb b/spec/foreman/export/upstart_spec.rb
+index e4d3e33..2151f74 100644
+--- a/spec/foreman/export/upstart_spec.rb
++++ b/spec/foreman/export/upstart_spec.rb
+@@ -11,7 +11,7 @@ describe Foreman::Export::Upstart, :fakefs do
+   let(:upstart)   { Foreman::Export::Upstart.new("/tmp/init", engine, options) }
+ 
+   before(:each) { load_export_templates_into_fakefs("upstart") }
+-  before(:each) { stub(upstart).say }
++  before(:each) { allow(upstart).to receive(:say) }
+ 
+   it "exports to the filesystem" do
+     upstart.export
+@@ -24,15 +24,15 @@ describe Foreman::Export::Upstart, :fakefs do
+   end
+ 
+   it "cleans up if exporting into an existing dir" do
+-    mock(FileUtils).rm("/tmp/init/app.conf")
+-    mock(FileUtils).rm("/tmp/init/app-alpha.conf")
+-    mock(FileUtils).rm("/tmp/init/app-alpha-1.conf")
+-    mock(FileUtils).rm("/tmp/init/app-bravo.conf")
+-    mock(FileUtils).rm("/tmp/init/app-bravo-1.conf")
+-    mock(FileUtils).rm("/tmp/init/app-foo-bar.conf")
+-    mock(FileUtils).rm("/tmp/init/app-foo-bar-1.conf")
+-    mock(FileUtils).rm("/tmp/init/app-foo_bar.conf")
+-    mock(FileUtils).rm("/tmp/init/app-foo_bar-1.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-alpha.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-alpha-1.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-bravo.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-bravo-1.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-foo-bar.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-foo-bar-1.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-foo_bar.conf")
++    expect(FileUtils).to receive(:rm).with("/tmp/init/app-foo_bar-1.conf")
+ 
+     upstart.export
+     upstart.export
+@@ -44,7 +44,7 @@ describe Foreman::Export::Upstart, :fakefs do
+     ["app2", "app2-alpha", "app2-alpha-1"].each do |name|
+       path = "/tmp/init/#{name}.conf"
+       FileUtils.touch(path)
+-      dont_allow(FileUtils).rm(path)
++      expect(FileUtils).to_not receive(:rm).with(path)
+     end
+ 
+     upstart.export
+@@ -56,7 +56,7 @@ describe Foreman::Export::Upstart, :fakefs do
+     ["app-worker", "app-worker-worker", "app-worker-worker-1"].each do |name|
+       path = "/tmp/init/#{name}.conf"
+       FileUtils.touch(path)
+-      dont_allow(FileUtils).rm(path)
++      expect(FileUtils).to_not receive(:rm).with(path)
+     end
+ 
+     upstart.export
+diff --git a/spec/foreman/export_spec.rb b/spec/foreman/export_spec.rb
+index 2008dab..f98d40e 100644
+--- a/spec/foreman/export_spec.rb
++++ b/spec/foreman/export_spec.rb
+@@ -6,7 +6,7 @@ describe "Foreman::Export" do
+ 
+   describe "with a formatter that doesn't declare the appropriate class" do
+     it "prints an error" do
+-      mock(subject).require("foreman/export/invalidformatter")
++      expect(subject).to receive(:require).with("foreman/export/invalidformatter")
+       mock_export_error("Unknown export format: invalidformatter (no class Foreman::Export::Invalidformatter).") do
+         subject.formatter("invalidformatter") 
+       end
+diff --git a/spec/foreman/process_spec.rb b/spec/foreman/process_spec.rb
+index 1837506..d449c95 100644
+--- a/spec/foreman/process_spec.rb
++++ b/spec/foreman/process_spec.rb
+@@ -55,13 +55,13 @@ describe Foreman::Process do
+     end
+ 
+     it "can execute" do
+-      mock(Kernel).exec "bin/command"
++      expect(Kernel).to receive(:exec).with("bin/command")
+       process = Foreman::Process.new("bin/command")
+       process.exec
+     end
+ 
+     it "can execute with env" do
+-      mock(Kernel).exec "bin/command bar"
++      expect(Kernel).to receive(:exec).with("bin/command bar")
+       process = Foreman::Process.new("bin/command $FOO")
+       process.exec(:env => { "FOO" => "bar" })
+     end
+diff --git a/spec/foreman_spec.rb b/spec/foreman_spec.rb
+index 77b7615..df68cb3 100644
+--- a/spec/foreman_spec.rb
++++ b/spec/foreman_spec.rb
+@@ -5,7 +5,7 @@ describe Foreman do
+ 
+   describe "VERSION" do
+     subject { Foreman::VERSION }
+-    it { should be_a String }
++    it { is_expected.to be_a String }
+   end
+ 
+   describe "runner" do
+diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
+index ef08802..b09e012 100644
+--- a/spec/spec_helper.rb
++++ b/spec/spec_helper.rb
+@@ -13,7 +13,7 @@ end
+ 
+ def mock_error(subject, message)
+   mock_exit do
+-    mock(subject).puts("ERROR: #{message}")
++    expect(subject).to receive(:puts).with("ERROR: #{message}")
+     yield
+   end
+ end
+@@ -164,11 +164,9 @@ ensure
+ end
+ 
+ RSpec.configure do |config|
+-  config.treat_symbols_as_metadata_keys_with_true_values = true
+   config.color = true
+   config.order = 'rand'
+   config.include FakeFS::SpecHelpers, :fakefs
+-  config.mock_with :rr
+   config.before(:each) do
+     FileUtils.mkdir_p('/tmp')
+   end
diff --git a/debian/patches/series b/debian/patches/series
index c7b7ee6..e247f6c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 0001-Look-for-data-in-usr-share-foreman.patch
 0003-spec_helper-misc-changes-to-run-against-Debian-packa.patch
 0004-Add-missing-.env-file-required-for-tests.patch
+0004-port-to-rspec-3.patch

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



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