Sha256: d0c1881eb06ab2b927940678f8d4ace1de38f3c7800677e19d433de1bb750d8d

Contents?: true

Size: 1.09 KB

Versions: 12

Compression:

Stored size: 1.09 KB

Contents

require 'assert'
require 'sanford-protocol/test/helpers'

module Sanford::Protocol::Test::Helpers

  class BaseTests < Assert::Context
    desc "the test helpers"
    subject { Sanford::Protocol::Test::Helpers }

    should have_imeths :fake_socket_with_request, :fake_socket_with_msg_body
    should have_imeths :fake_socket_with_encoded_msg_body, :fake_socket_with
    should have_imeths :read_response_from_fake_socket
    should have_imeths :read_written_response_from_fake_socket

    should "be able to read responses given a fake socket" do
      setup_some_response_data
      fs = FakeSocket.new(@msg)
      response = subject.read_response_from_fake_socket(fs)

      assert_kind_of Sanford::Protocol::Response, response
      assert_equal @data, response.to_hash
    end

    should "be able to read responses written to a fake socket" do
      setup_some_response_data
      fs = FakeSocket.new; fs.send(@msg, 0)
      response = subject.read_written_response_from_fake_socket(fs)

      assert_kind_of Sanford::Protocol::Response, response
      assert_equal @data, response.to_hash
    end

  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sanford-protocol-0.6.0 test/unit/test_helpers_tests.rb
sanford-protocol-0.5.6 test/unit/test_helpers_tests.rb
sanford-protocol-0.5.5 test/unit/test_helpers_tests.rb
sanford-protocol-0.5.4 test/unit/test_helpers_tests.rb
sanford-protocol-0.5.3 test/unit/test_helpers_tests.rb
sanford-protocol-0.5.1 test/unit/test_helpers_tests.rb
sanford-protocol-0.5.0 test/unit/test_helpers_tests.rb
sanford-protocol-0.4.1 test/unit/test_helpers_tests.rb
sanford-protocol-0.4.0 test/unit/test_helpers_tests.rb
sanford-protocol-0.3.0 test/unit/test_helpers_tests.rb
sanford-protocol-0.2.0 test/unit/test_helpers_tests.rb
sanford-protocol-0.1.0 test/unit/test_helpers_tests.rb