Sha256: 17936bb5468cb6b01d3751de7195b3702f92a69450081e8cc3bc2c768e8091c1

Contents?: true

Size: 1.1 KB

Versions: 19

Compression:

Stored size: 1.1 KB

Contents

$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
require 'pho'
require 'test/unit'
require 'yaml'
class EtagsTest < Test::Unit::TestCase
  
  def test_it()
  
    io = StringIO.new("---\n- http://www.example.org : '12345'")
    etags = Pho::Etags.new(io)
    
    assert_equal(true, etags.has_tag?("http://www.example.org") )
    assert_equal("12345", etags.get("http://www.example.org") )
    
    etags.add("http://www.example.com/foo", "abc")
    assert_equal(false, etags.saved)
    
    etags.save()
    
  end

  def test_overwrite()
    etags = Pho::Etags.new()
    etags.add("http://www.example.org", "etag")
    assert_equal("etag", etags.get("http://www.example.org") )
    etags.add("http://www.example.org", "etag_updated")
    assert_equal("etag_updated", etags.get("http://www.example.org") )
  end  
  
  def test_add_from_response()
    response = HTTP::Message.new_response("description")
    response.header["ETag"] = "abcdef"
    etags = Pho::Etags.new()
    etags.add_from_response("http://www.example.org", response)
    assert_equal("abcdef", etags.get("http://www.example.org") )    
  end
  
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
pho-0.7.9 tests/tc_etags.rb
pho-0.7.8 tests/tc_etags.rb
pho-0.7.7 tests/tc_etags.rb
pho-0.7.5 tests/tc_etags.rb
pho-0.7.4 tests/tc_etags.rb
pho-0.7.3 tests/tc_etags.rb
pho-0.7.2 tests/tc_etags.rb
pho-0.7.1 tests/tc_etags.rb
pho-0.7 tests/tc_etags.rb
pho-0.6.2 tests/tc_etags.rb
pho-0.6.1 tests/tc_etags.rb
pho-0.6 tests/tc_etags.rb
pho-0.4.1 tests/tc_etags.rb
pho-0.0.1 tests/tc_etags.rb
pho-0.4 tests/tc_etags.rb
pho-0.3 tests/tc_etags.rb
pho-0.2 tests/tc_etags.rb
pho-0.1 tests/tc_etags.rb
pho-0.5 tests/tc_etags.rb