Sha256: fceef7a94003b1ab8e885eb9154aef82a16ceb365b897bd49cbd6c9618c3eef2
Contents?: true
Size: 1.64 KB
Versions: 1
Compression:
Stored size: 1.64 KB
Contents
#! /usr/bin/env ruby # coding: utf-8 require 'helper' require "fileutils" require "test/unit" #require "imagut/urllogger.rb" require "imagut.rb" class TC_UrlLogger < Test::Unit::TestCase def setup @ul00 = Imagut::UrlLogger.new("test/urllogger") end def test_initialize assert_raises(Imagut::UrlLogger::InitializeError){ Imagut::UrlLogger.new("") } end def test_include? assert_equal(true , @ul00.include?("http://a.b.c/d0.html")) assert_equal(true , @ul00.include?("http://a.b.c/d1.html")) assert_equal(true , @ul00.include?("http://a.b.c/d2.html")) assert_equal(true , @ul00.include?("http://a.b.c/d3.html")) assert_equal(false, @ul00.include?("http://a.b.c/d4.html")) end def test_write_with_filename log_file = "test/urllogger/dummy.log" FileUtils.rm log_file if File.exist? log_file assert_equal(false, @ul00.include?("a")) assert_equal(false, @ul00.include?("b")) @ul00.write("a", log_file) @ul00.write("b", log_file) assert_equal(true , File.exist?(log_file)) assert_equal(true , @ul00.include?("a")) assert_equal(true , @ul00.include?("b")) FileUtils.rm log_file if File.exist? log_file end def test_write_without_filename log_file = DateTime.now.strftime("test/urllogger/%C%g%m%d.log") FileUtils.rm log_file if File.exist? log_file assert_equal(false, @ul00.include?("a")) assert_equal(false, @ul00.include?("b")) @ul00.write("a") @ul00.write("b") assert_equal(true , File.exist?(log_file)) assert_equal(true , @ul00.include?("a")) assert_equal(true , @ul00.include?("b")) FileUtils.rm log_file if File.exist? log_file end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
imagut-0.0.4 | test/test_urllogger.rb |