]> gitweb.fluxo.info Git - puppet-mailalias_core.git/commitdiff
(maint) Mock with rspec not mocha
authorMelissa Stone <melissa@puppet.com>
Fri, 18 May 2018 17:41:13 +0000 (10:41 -0700)
committerMelissa Stone <melissa@puppet.com>
Fri, 18 May 2018 18:14:56 +0000 (11:14 -0700)
.sync.yml
spec/shared_behaviours/all_parsedfile_providers.rb
spec/spec_helper.rb
spec/unit/type/mailalias_spec.rb

index 367f6668e990e585aa83c6e6f6f0e5df2ac1c01f..34b1c2f41327f45e7de812c087957421d666cabf 100644 (file)
--- a/.sync.yml
+++ b/.sync.yml
@@ -26,3 +26,6 @@ Gemfile:
 Rakefile:
   requires:
     - puppet-lint/tasks/puppet-lint
+
+spec/spec_helper.rb:
+  mock_with: ':rspec'
index d697a14c7520443e908697d59cd453dc4739733c..1701fe336a6191724ca33d79f1f0a3603919301d 100644 (file)
@@ -5,7 +5,7 @@ shared_examples_for 'all parsedfile providers' do |provider, *files|
 
   files.flatten.each do |file|
     it "should rewrite #{file} reasonably unchanged" do
-      provider.stubs(:default_target).returns(file)
+      allow(provider).to receive(:default_target).and_return(file)
       provider.prefetch
 
       text = provider.to_file(provider.target_records(file))
index e117192684d1d907d001bf542592bdea4f0e470e..b71d71e59d9813d743273d7d968218e7b5eddc99 100644 (file)
@@ -1,3 +1,6 @@
+RSpec.configure do |c|
+  c.mock_with :rspec
+end
 
 require 'puppetlabs_spec_helper/module_spec_helper'
 require 'rspec-puppet-facts'
index 1fb195e72ac7bedcd7f3faf3900d8886879a22a5..80b838c43b474bdfe42b4c0330906e19ee6d1d22 100644 (file)
@@ -29,13 +29,13 @@ describe Puppet::Type.type(:mailalias) do
 
   it 'tries and set the recipient when it does the sync' do
     expect(recipient_resource.retrieve_resource[:recipient]).to eq(:absent)
-    recipient_resource.property(:recipient).expects(:set).with(['yay'])
+    expect(recipient_resource.property(:recipient)).to receive(:set).with(['yay'])
     recipient_resource.property(:recipient).sync
   end
 
   it 'tries and set the included file when it does the sync' do
     expect(file_resource.retrieve_resource[:file]).to eq(:absent)
-    file_resource.property(:file).expects(:set).with(tmpfile_path)
+    expect(file_resource.property(:file)).to receive(:set).with(tmpfile_path)
     file_resource.property(:file).sync
   end