Sha256: f04e433376eec6be11164a3e5f7b689aa9287e6076f0af663633beb297a96e4e

Contents?: true

Size: 1.41 KB

Versions: 6

Compression:

Stored size: 1.41 KB

Contents

require File.join(File.dirname(__FILE__), 'test_helper.rb')
require 'rbkb/http'

module HttpTestHelper
  # contains various test cases to test common interface features
  module CommonInterfaceTests

    def setup()
      raise "Helper stub called. Override setup() in TestCase"
    end

    def do_type_tests(x)
      raise "Helper stub called. Override do_type_tests() in TestCase"
    end

    def do_type_tests(x)
      raise "Helper stub called. Override do_capture_value_tests() in TestCase"
    end

    def test_init_parse
      req = @obj_klass.new(@rawdat, @obj_opts)
      do_capture_value_tests(req)
      do_type_tests(req)
    end

    def test_parse
      req = @obj_klass.parse(@rawdat, @obj_opts)
      do_capture_value_tests(req)
      do_type_tests(req)
    end

    def test_capture
      req = @obj.capture(@rawdat)
      do_capture_value_tests(req)
      do_type_tests(req)
    end

    def test_back_to_raw
      req = @obj.capture(@rawdat)
      assert_equal @rawdat_crlf, req.to_raw
    end

    def test_capture_and_reuse_nondestructive
      @obj.capture(@rawdat_crlf)
      @obj.reset_capture
      @obj.capture(@rawdat_crlf)
      do_capture_value_tests(@obj)
      do_type_tests(@obj)
    end

    def test_capture_and_reuse_destructive
      @obj.capture(@rawdat_crlf)
      @obj.reset_capture!
      @obj.capture(@rawdat_crlf)
      do_capture_value_tests(@obj)
      do_type_tests(@obj)
    end

  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
emonti-rbkb-0.6.6 test/test_http_helper.rb
emonti-rbkb-0.6.7 test/test_http_helper.rb
emonti-rbkb-0.6.8 test/test_http_helper.rb
emonti-rbkb-0.6.9.1 test/test_http_helper.rb
emonti-rbkb-0.6.9 test/test_http_helper.rb
rbkb-0.6.10 test/test_http_helper.rb