Sha256: 81b2805e58099d1ab689d6bdc5b3d5fc86255d2b8754ec19d6a1d8a3ce2c4927

Contents?: true

Size: 1.56 KB

Versions: 4

Compression:

Stored size: 1.56 KB

Contents

require 'spec_helper'
require 'rtsp/helpers'

class HelperTest
  include RTSP::Helpers
end

describe RTSP::Helpers do
  describe "#build_resource_uri_from" do
    before do
      @my_object = HelperTest.new
    end

    context "parses the resource URL to a URI" do
      it "with scheme, IP, path; port defaults to 554" do
        uri = @my_object.build_resource_uri_from "rtsp://64.202.98.91/sa.sdp"
        uri.scheme.should == "rtsp"
        uri.host.should == "64.202.98.91"
        uri.port.should == 554
        uri.path.should == "/sa.sdp"
      end

      it "with IP, path; port defaults to 554; scheme defaults to 'rtsp'" do
        uri = @my_object.build_resource_uri_from "64.202.98.91/sa.sdp"
        uri.scheme.should == "rtsp"
        uri.host.should == "64.202.98.91"
        uri.port.should == 554
        uri.path.should == "/sa.sdp"
      end

      it "with scheme, IP, port" do
        uri = @my_object.build_resource_uri_from "rtsp://64.202.98.91"
        uri.scheme.should == "rtsp"
        uri.host.should == "64.202.98.91"
        uri.port.should == 554
        uri.path.should == ""
        uri.to_s.should == "rtsp://64.202.98.91:554"
      end

      it "handles passing in a URI" do
        uri = @my_object.build_resource_uri_from "rtsp://64.202.98.91"
        lambda { @my_object.build_resource_uri_from uri
          }.should raise_error
      end

      it "raises if not given a String" do
        lambda do
          @my_object.build_resource_uri_from URI.parse "rtsp://64.202.98.91"
        end.should raise_exception RTSP::Error
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rtsp-0.4.5 spec/unit/rtsp/helpers_spec.rb
rtsp-0.4.4 spec/unit/rtsp/helpers_spec.rb
rtsp-0.4.3 spec/unit/rtsp/helpers_spec.rb
rtsp-0.4.2 spec/unit/rtsp/helpers_spec.rb