Project

General

Profile

Actions

Bug #19573

closed

assert_match on CommandExpectation raises exception

Added by Tomáš Strachota over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
Hammer core
Target version:
Difficulty:
Triaged:
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

When HammerCLI::Testing::CommandAssertions are included into global namespace the method CommandExpectation#assert_match starts to collide with Minitest's assert_match.

This appears when CommandExpectation is used with regex for matching command's output:

expected_result = HammerCLI::Testing::CommandAssertions::CommandExpectation.new('', /.*created.*/, HammerCLI::EX_OK)
result = run_cmd('organization create')
assert_cmd(expected_result, result)

ArgumentError: wrong number of arguments (given 3, expected 1)
    /root/hammer/hammer-cli/lib/hammer_cli/testing/command_assertions.rb:15:in `assert_match'
    /root/hammer/hammer-cli/lib/hammer_cli/testing/command_assertions.rb:68:in `assert_equal_or_match'
    /root/hammer/hammer-cli/lib/hammer_cli/testing/command_assertions.rb:16:in `assert_match'
    /root/hammer/hammer-cli/lib/hammer_cli/testing/command_assertions.rb:57:in `assert_cmd'
    /root/hammer/hammer-cli-foreman-virt-who-configure/test/functional/config_test.rb:26:in `block (3 levels) in <top (required)>'
Actions

Also available in: Atom PDF