-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #767 from pirj/pin-rspec-expectations
Fix support for `rspec-expectations` 3.8.5+
- Loading branch information
Showing
10 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module RSpec::Puppet | ||
module GenericMatchers | ||
# Due to significant code base depending on the | ||
# | ||
# is_expected.to raise_error Puppet::Error | ||
# | ||
# syntax, and removal of this syntax from RSpec, extend RSpec's built-in | ||
# `raise_error` matcher to accept a value target, e.g. a subject defined | ||
# as a lambda, e.g.: | ||
# | ||
# subject(:catalogue) { lambda { load_catalogue } } | ||
# | ||
class RaiseError < RSpec::Matchers::BuiltIn::RaiseError | ||
def supports_value_expectations? | ||
true | ||
end | ||
end | ||
|
||
def raise_error(*args, &block) | ||
RaiseError.new(*args, &block) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'spec_helper' | ||
require 'rspec-puppet/support' | ||
|
||
describe RSpec::Puppet::GenericMatchers::RaiseError do | ||
include RSpec::Puppet::GenericMatchers | ||
|
||
context 'with a failing target' do | ||
subject { lambda { fail 'catalogue load failed' } } | ||
|
||
it { should raise_error 'catalogue load failed' } | ||
end | ||
|
||
context 'with a passing target' do | ||
subject { lambda { } } | ||
|
||
it { should_not raise_error } | ||
end | ||
end |