Skip to content

Commit

Permalink
Replace unless empty? with simpler if any?
Browse files Browse the repository at this point in the history
  • Loading branch information
nitishr authored and floehopper committed Feb 10, 2020
1 parent adf704c commit 365ce92
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/mocha/mockery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ def state_machines

def mocha_inspect
message = ''
message << "unsatisfied expectations:\n- #{unsatisfied_expectations.map(&:mocha_inspect).join("\n- ")}\n" unless unsatisfied_expectations.empty?
message << "satisfied expectations:\n- #{satisfied_expectations.map(&:mocha_inspect).join("\n- ")}\n" unless satisfied_expectations.empty?
message << "states:\n- #{state_machines.map(&:mocha_inspect).join("\n- ")}\n" unless state_machines.empty?
message << "unsatisfied expectations:\n- #{unsatisfied_expectations.map(&:mocha_inspect).join("\n- ")}\n" if unsatisfied_expectations.any?
message << "satisfied expectations:\n- #{satisfied_expectations.map(&:mocha_inspect).join("\n- ")}\n" if satisfied_expectations.any?
message << "states:\n- #{state_machines.map(&:mocha_inspect).join("\n- ")}\n" if state_machines.any?
message
end

Expand Down

0 comments on commit 365ce92

Please sign in to comment.