Skip to content

Commit

Permalink
Don't use legacy matcher protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
Neil Hemingway committed Dec 20, 2016
1 parent 7110a83 commit fcc622c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
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

0 comments on commit fcc622c

Please sign in to comment.