Sha256: dd5feef8975e93850a86ea1441648eaed14d783addabdc27d1d7bdfe87b92cd8

Contents?: true

Size: 966 Bytes

Versions: 3

Compression:

Stored size: 966 Bytes

Contents

require 'tmpdir'
require 'minitest/unit'

Mtbb.register(:navel,
  executable: File.expand_path('../navel', __FILE__),
  argv: %w(9899),
  server_name: 'mtbb-navel',
  port: 9899,
  working_dir: Dir.mktmpdir('mtbb-navel'),
)

describe 'navel test' do
  include Mtbb::NetThings

  it 'supports HTTP GET' do
    response = http('GET', '/affirmation', port: Mtbb.server(:navel).port)
    response.code.must_equal '200'
  end

  it 'supports HTTP POST' do
    response = http('POST', '/dinner/new',
         port: Mtbb.server(:navel).port, body: "soup=splitpea\n")
    response.code.must_equal '201'
  end

  it 'supports HTTP DELETE' do
    response = http('DELETE', '/pestilence', port: Mtbb.server(:navel).port)
    response.code.must_equal '204'
  end
end

class NavelTest < MiniTest::Unit
  include Mtbb::NetThings

  def test_works_with_unit_tests_too
    response = http('GET', '/nerp', port: Mtbb.server(:navel).port)
    response.code.must_equal '404'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mtbb-0.1.2 test/navel_test.rb
mtbb-0.1.1 test/navel_test.rb
mtbb-0.1.0 test/navel_test.rb