Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use legacy matcher protocol #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/rspec-puppet-augeas/matchers/execute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def description
end
end

def failure_message_for_should
def failure_message
if resource.txn.any_failed?
"#{resource} fails when executing:\n#{format_logs(resource.logs)}"
elsif change and !resource.txn.changed?.any?
Expand All @@ -54,7 +54,7 @@ def failure_message_for_should
end
end

def failure_message_for_should_not
def failure_message_when_negated
if resource.txn.any_failed?
"#{resource} succeeds when executed:\n#{format_logs(resource.logs)}"
elsif change and !resource.txn.changed?.any?
Expand Down
20 changes: 10 additions & 10 deletions spec/classes/sshd_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@
e = execute
e.matches? subject
e.description.should =~ /execute/
e.failure_message_for_should.should =~ /^err:.*(false|failed)/
e.failure_message_for_should_not.should =~ /^err:.*(false|failed)/
e.failure_message.should =~ /^err:.*(false|failed)/
e.failure_message_when_negated.should =~ /^err:.*(false|failed)/
# Check for debug logs
e.failure_message_for_should.should =~ /^debug:.*Opening augeas/
e.failure_message.should =~ /^debug:.*Opening augeas/
# Ignore transaction stuff
e.failure_message_for_should.split("\n").grep(/Finishing transaction/).empty?.should eq(true)
e.failure_message.split("\n").grep(/Finishing transaction/).empty?.should eq(true)
end
end

Expand All @@ -130,8 +130,8 @@
e = execute
e.with_change.matches? subject
e.description.should =~ /change successfully/
e.failure_message_for_should.should =~ /doesn't change/
e.failure_message_for_should_not.should =~ /changes/
e.failure_message.should =~ /doesn't change/
e.failure_message_when_negated.should =~ /changes/
end

it 'should be considered idempotent' do
Expand All @@ -145,8 +145,8 @@
e = execute
e.with_change.idempotently.matches? subject
e.description.should =~ /change once only/
e.failure_message_for_should.should =~ /doesn't change/
e.failure_message_for_should_not.should =~ /changes/
e.failure_message.should =~ /doesn't change/
e.failure_message_when_negated.should =~ /changes/
end
end

Expand All @@ -161,8 +161,8 @@
e = execute
e.idempotently.matches? subject
e.description.should =~ /change at most once/
e.failure_message_for_should.should =~ /^notice:.*success/
e.failure_message_for_should_not.should =~ /^notice:.*success/
e.failure_message.should =~ /^notice:.*success/
e.failure_message_when_negated.should =~ /^notice:.*success/
end
end
end