Sha256: 7c4849cd0af070e3fec4f0229b3cf1ebdaf9cd4a8c084c4ca24c23267b90fbb1

Contents?: true

Size: 1.53 KB

Versions: 2

Compression:

Stored size: 1.53 KB

Contents

$:.unshift File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), "..", "test"))
require 'test_helper'
require 'rets4r/client/links'

class TestClientLinks < Test::Unit::TestCase
  def setup
    @links = RETS4R::Client::Links.from_login_url('http://example.com/login')
    @links['Logout'] = URI.parse('http://example.com/logout')
    @links['GetMetadata'] = URI.parse('http://example.com/metadata')
    @links['GetObject'] = URI.parse('http://example.com/objects')
    @links['Search'] = URI.parse('http://example.com/search')
    @links['Action'] = URI.parse('http://example.com/action')
  end
  def test_should_build_from_login_url
    assert_equal normalize_url('http://example.com/login'), @links['Login'].to_s
  end
  def test_should_access_login
    assert_equal normalize_url('http://example.com/login'), @links.login.to_s
  end
  def test_should_access_logout
    assert_equal normalize_url('http://example.com/logout'), @links.logout.to_s
  end
  def test_should_access_metadata
    assert_equal normalize_url('http://example.com/metadata'), @links.metadata.to_s
  end
  def test_should_access_object
    assert_equal normalize_url('http://example.com/objects'), @links.objects.to_s
  end
  def test_should_access_search
    assert_equal normalize_url('http://example.com/search'), @links.search.to_s
  end
  def test_should_access_action
    assert_equal normalize_url('http://example.com/action'), @links.action.to_s
  end
  def normalize_url(url)
    URI.parse(url).to_s
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
rets4r-1.1.18 test/test_client_links.rb
jschairb-rets4r-1.1.18 test/test_client_links.rb