21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-05-11 04:58:38 +02:00
chexpire/test/services/whois/command_test.rb
2018-05-30 17:01:32 +02:00

28 lines
597 B
Ruby

require "test_helper"
require "whois/command"
module Whois
class CommandTest < ActiveSupport::TestCase
test "should return the result and log the command" do
result = "mocked whois result"
mock = Minitest::Mock.new
mock.expect(:execute, result)
stub = lambda do |program, args, _logger|
assert_equal "whois", program
assert_equal "example.org", args
mock
end
SystemCommand.stub(:new, stub) do
command = Command.new("example.org")
assert_equal result, command.run
end
mock.verify
end
end
end