Module: CommandTest::Adapters::TestUnit::Assertions

Defined in:
lib/command_test/adapters/test_unit.rb

Instance Method Summary collapse

Instance Method Details

#assert_does_not_run_command(*expected, &block) ⇒ Object

Passes if the block does not run the given command.

assert_does_not_run_command 'convert', 'evil.gif', 'good.png' do
  ...
end

Commands are matched according to CommandTest.match? .



31
32
33
34
35
36
37
# File 'lib/command_test/adapters/test_unit.rb', line 31

def assert_does_not_run_command(*expected, &block)
  result = Tests::RunsCommand.new(expected, &block)
  matches = result.matches?
  assert_block(matches ? result.negative_failure_message : nil) do
    !matches
  end
end

#assert_runs_command(*expected, &block) ⇒ Object

Passes if the block runs the given command.

assert_runs_command 'convert', 'evil.gif', 'good.png' do
  ...
end

Commands are matched according to CommandTest.match? .



14
15
16
17
18
19
20
# File 'lib/command_test/adapters/test_unit.rb', line 14

def assert_runs_command(*expected, &block)
  result = Tests::RunsCommand.new(expected, &block)
  matches = result.matches?
  assert_block(matches ? nil : result.positive_failure_message) do
    matches
  end
end