code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
require 'rubygems/test_case'
require "rubygems/version"
class TestGemVersion < Gem::TestCase
def test_bump
assert_bumped_version_equal "5.3", "5.2.4"
end
def test_bump_alpha
assert_bumped_version_equal "5.3", "5.2.4.a"
end
def test_bump_alphanumeric
assert_bumped_version_equal "5.3", "5.2.4.a1... | Ruby |
require 'rubygems/test_case'
require 'rubygems/commands/dependency_command'
class TestGemCommandsDependencyCommand < Gem::TestCase
def setup
super
@cmd = Gem::Commands::DependencyCommand.new
@cmd.options[:domain] = :local
util_setup_fake_fetcher true
end
def test_execute
quick_gem 'foo' d... | Ruby |
require 'rubygems/package/tar_test_case'
require 'rubygems/package/tar_writer'
class TestTarWriter < Gem::Package::TarTestCase
def setup
super
@data = 'abcde12345'
@io = TempIO.new
@tar_writer = Gem::Package::TarWriter.new @io
end
def teardown
@tar_writer.close unless @tar_writer.closed?
... | Ruby |
require 'rubygems/test_case'
require 'rubygems/commands/contents_command'
class TestGemCommandsContentsCommand < Gem::TestCase
def setup
super
@cmd = Gem::Commands::ContentsCommand.new
end
def gem name
spec = quick_gem name do |gem|
gem.files = %W[lib/#{name}.rb Rakefile]
end
write_f... | Ruby |
require 'rubygems/test_case'
require 'rubygems/commands/build_command'
require 'rubygems/format'
class TestGemCommandsBuildCommand < Gem::TestCase
def setup
super
@gem = quick_spec 'some_gem' do |s|
s.rubyforge_project = 'example'
end
@cmd = Gem::Commands::BuildCommand.new
end
def test_... | Ruby |
require 'rubygems/test_case'
require 'rubygems/command_manager'
class TestGemCommandManager < Gem::TestCase
def setup
super
@command_manager = Gem::CommandManager.instance
end
def test_run_interrupt
old_load_path = $:.dup
$: << File.expand_path("test/rubygems", @@project_dir)
Gem.load_env_... | Ruby |
require 'rubygems/test_case'
require 'stringio'
require 'rubygems/specification'
class TestGemSpecification < Gem::TestCase
LEGACY_YAML_SPEC = <<-EOF
--- !ruby/object:Gem::Specification
rubygems_version: "1.0"
name: keyedlist
version: !ruby/object:Gem::Version
version: 0.4.0
date: 2004-03-28 15:37:49.828000 +02:0... | Ruby |
class TestGem
TEST_PLUGIN_LOAD = :loaded
end
| Ruby |
TestGem::TEST_PLUGIN_EXCEPTION = :loaded
raise Exception.new('boom') | Ruby |
TestGem::TEST_PLUGIN_STANDARDERROR = :loaded
raise StandardError.new('boom') | Ruby |
class Gem::Commands::CrashCommand < Gem::Command
raise "crash"
end | Ruby |
require 'rubygems/test_case'
require "rubygems/text"
class TestGemText < Gem::TestCase
include Gem::Text
def test_format_text
assert_equal "text to\nwrap", format_text("text to wrap", 8)
end
def test_format_text_indent
assert_equal " text to\n wrap", format_text("text to wrap", 8, 2)
end
d... | Ruby |
require 'rubygems/test_case'
require 'rubygems/gem_path_searcher'
class Gem::GemPathSearcher
attr_accessor :gemspecs
attr_accessor :lib_dirs
end
class TestGemGemPathSearcher < Gem::TestCase
def setup
super
@foo1 = new_spec 'foo', '0.1', nil, "lib/foo.rb"
@foo1.require_paths << 'lib2'
path = Fil... | Ruby |
require 'rubygems/test_case'
require "rubygems/requirement"
class TestGemRequirement < Gem::TestCase
def test_equals2
r = req "= 1.2"
assert_equal r, r.dup
assert_equal r.dup, r
refute_requirement_equal "= 1.2", "= 1.3"
refute_requirement_equal "= 1.3", "= 1.2"
refute_equal Object.new, req... | Ruby |
require 'rubygems'
def install_session
path_to_gem = File.join("redist", "session.gem")
begin
Gem::Installer.new(path_to_gem).install
rescue Errno::EACCES => ex
puts
puts "*****************************************************************"
puts "Unable to install Gem 'Session'."
puts "Reason: ... | Ruby |
require 'rubygems/test_case'
require 'rubygems/dependency'
class TestGemDependency < Gem::TestCase
def test_initialize
d = dep "pkg", "> 1.0"
assert_equal "pkg", d.name
assert_equal req("> 1.0"), d.requirement
end
def test_initialize_double
d = dep "pkg", "> 1.0", "< 2.0"
assert_equal req("... | Ruby |
require "rubygems"
require "rubygems/test_case"
require "rubygems/commands/help_command"
require "rubygems/format"
require "rubygems/command_manager"
class TestGemCommandsHelpCommand < Gem::TestCase
def setup
super
@cmd = Gem::Commands::HelpCommand.new
end
def test_gem_help_bad
util_gem 'bad' do |o... | Ruby |
SIMPLE_GEM = <<-GEMDATA
MD5SUM = "989bf34a1cbecd52e0ea66b662b3a405"
if $0 == __FILE__
require 'optparse'
options = {}
ARGV.options do |opts|
opts.on_tail("--help", "show this message") {puts opts; exit}
opts.on('--dir=DIRNAME', "Installation directo... | Ruby |
require 'rubygems/test_case'
require 'rubygems/indexer'
unless defined?(Builder::XChar) then
warn "Gem::Indexer tests are being skipped. Install builder gem." if $VERBOSE
end
class TestGemIndexer < Gem::TestCase
def setup
super
util_clear_gems
util_make_gems
@d2_0 = quick_spec 'd', '2.0' do |s... | Ruby |
require 'rubygems/test_case'
require 'rubygems'
require 'fileutils'
class TestGemPathSupport < Gem::TestCase
def setup
super
ENV["GEM_HOME"] = @tempdir
ENV["GEM_PATH"] = [@tempdir, "something"].join(File::PATH_SEPARATOR)
end
def test_initialize
ps = Gem::PathSupport.new
assert_equal ENV["G... | Ruby |
require 'rubygems/test_case'
require 'rubygems/commands/install_command'
begin
gem "rdoc"
gem "json"
rescue Gem::LoadError
# ignore
end
class TestGemCommandsInstallCommand < Gem::TestCase
def setup
super
@cmd = Gem::Commands::InstallCommand.new
@cmd.options[:generate_rdoc] = false
@cmd.optio... | Ruby |
require 'rubygems/test_case'
require 'rubygems/dependency_list'
class TestGemDependencyList < Gem::TestCase
def setup
super
util_clear_gems
@deplist = Gem::DependencyList.new
# TODO: switch to new_spec
@a1 = quick_spec 'a', '1'
@a2 = quick_spec 'a', '2'
@a3 = quick_spec 'a', '3'
... | Ruby |
require 'rubygems/test_case'
require 'rubygems/commands/cert_command'
require 'rubygems/fix_openssl_warnings' if RUBY_VERSION < "1.9"
unless defined? OpenSSL then
warn "`gem cert` tests are being skipped, module OpenSSL not found"
end
class TestGemCommandsCertCommand < Gem::TestCase
def setup
super
@ori... | Ruby |
require 'rubygems/test_case'
require 'rubygems/indexer'
require 'rubygems/commands/generate_index_command'
class TestGemCommandsGenerateIndexCommand < Gem::TestCase
def setup
super
@cmd = Gem::Commands::GenerateIndexCommand.new
@cmd.options[:directory] = @gemhome
end
def test_execute
use_ui @u... | Ruby |
require 'rubygems/test_case'
require 'rubygems'
class TestConfig < Gem::TestCase
def test_datadir
_, err = capture_io do
datadir = RbConfig::CONFIG['datadir']
assert_equal "#{datadir}/xyz", RbConfig.datadir('xyz')
end
assert_match(/deprecate/, err)
end
end
| Ruby |
require 'rubygems/test_case'
require 'rubygems'
require 'rubygems/command'
require 'rubygems/gemcutter_utilities'
class TestGemGemcutterUtilities < Gem::TestCase
def setup
super
ENV['RUBYGEMS_HOST'] = nil
Gem.configuration.rubygems_api_key = nil
@cmd = Gem::Command.new '', 'summary'
@cmd.exten... | Ruby |
require 'rubygems/test_case'
class TestKernel < Gem::TestCase
def setup
super
@old_path = $:.dup
util_make_gems
end
def teardown
super
$:.replace @old_path
end
def test_gem
assert gem('a', '= 1'), "Should load"
assert $:.any? { |p| %r{a-1/lib} =~ p }
end
def test_gem_re... | Ruby |
require 'rubygems/test_case'
require 'rubygems'
require 'rubygems/gem_openssl'
require 'rubygems/installer'
require 'pathname'
require 'tmpdir'
class TestGem < Gem::TestCase
def setup
super
@additional = %w[a b].map { |d| File.join @tempdir, d }
@default_dir_re = if RUBY_VERSION > '1.9' then
... | Ruby |
##
# HACK: this drives me BONKERS
if defined? OpenSSL then
class OpenSSL::X509::ExtensionFactory
alias :old_create_ext :create_ext
def create_ext(*args)
@config ||= nil
old_create_ext(*args)
end
end
end if RUBY_VERSION < "1.9"
| Ruby |
require 'rubygems/package/tar_test_case'
require 'rubygems/package'
class TestGemPackageTarHeader < Gem::Package::TarTestCase
def setup
super
header = {
:name => 'x',
:mode => 0644,
:uid => 1000,
:gid => 10000,
:size => 100,
:mtime => 12345,
... | Ruby |
require 'rubygems/test_case'
require 'rubygems/command'
require 'rubygems/version_option'
class TestGemVersionOption < Gem::TestCase
def setup
super
@cmd = Gem::Command.new 'dummy', 'dummy'
@cmd.extend Gem::VersionOption
end
def test_add_platform_option
@cmd.add_platform_option
assert @cm... | Ruby |
require 'test/unit'
require 'cmath'
class TestCMath < Test::Unit::TestCase
def test_sqrt
assert_equal CMath.sqrt(1.0.i), CMath.sqrt(1.i), '[ruby-core:31672]'
end
def test_acos
assert_in_delta CMath.acos(Complex(3, 4)), Complex(0.9368124611557199,-2.305509031243477)
end
def test_cbrt_returns_princip... | Ruby |
require_relative 'inlinetest.rb'
target = __FILE__[/test_(.*\.rb)$/, 1]
InlineTest.loadtest__END__part(target)
| Ruby |
require 'minitest/spec'
require 'benchmark'
MiniTest::Unit.autorun
describe Benchmark do
BENCH_FOR_TIMES_UPTO = lambda do |x|
n = 1000
tf = x.report("for:") { for _ in 1..n; '1'; end }
tt = x.report("times:") { n.times do ; '1'; end }
tu = x.report("upto:") { 1.upto(n) do ; '1'; end }
[tf+t... | Ruby |
#!/usr/bin/env ruby -w
# encoding: UTF-8
# tc_data_converters.rb
#
# Created by James Edward Gray II on 2005-10-31.
# Copyright 2005 James Edward Gray II. You can redistribute or modify this code
# under the terms of Ruby's license.
require_relative "base"
class TestCSV::DataConverters < TestCSV
extend Differen... | Ruby |
#!/usr/bin/env ruby -w
# encoding: UTF-8
# tc_features.rb
#
# Created by James Edward Gray II on 2005-10-31.
# Copyright 2005 James Edward Gray II. You can redistribute or modify this code
# under the terms of Ruby's license.
require "zlib"
require_relative "base"
require "tempfile"
class TestCSV::Features < Tes... | Ruby |
#!/usr/bin/env ruby -w
# encoding: UTF-8
# tc_csv_parsing.rb
#
# Created by James Edward Gray II on 2005-10-31.
# Copyright 2005 James Edward Gray II. You can redistribute or modify this code
# under the terms of Ruby's license.
require "timeout"
require_relative "base"
#
# Following tests are my interpretation ... | Ruby |
require "test/unit"
require "csv"
require_relative "../with_different_ofs.rb"
class TestCSV < Test::Unit::TestCase
end
| Ruby |
#!/usr/bin/env ruby -w
# encoding: UTF-8
# tc_headers.rb
#
# Created by James Edward Gray II on 2005-10-31.
# Copyright 2005 James Edward Gray II. You can redistribute or modify this code
# under the terms of Ruby's license.
require_relative "base"
class TestCSV::Headers < TestCSV
extend DifferentOFS
def set... | Ruby |
#!/usr/bin/env ruby -w
# encoding: UTF-8
# tc_table.rb
#
# Created by James Edward Gray II on 2005-10-31.
# Copyright 2005 James Edward Gray II. You can redistribute or modify this code
# under the terms of Ruby's license.
require_relative "base"
class TestCSV::Table < TestCSV
extend DifferentOFS
def setup
... | Ruby |
#!/usr/bin/env ruby -w
# encoding: UTF-8
# tc_serialization.rb
#
# Created by James Edward Gray II on 2005-10-31.
# Copyright 2005 James Edward Gray II. You can redistribute or modify this code
# under the terms of Ruby's license.
require_relative "base"
require "tempfile"
# An example of how to provide custom CS... | Ruby |
#!/usr/bin/env ruby -w
# encoding: UTF-8
# ts_all.rb
#
# Created by James Edward Gray II on 2005-10-31.
# Copyright 2005 James Edward Gray II. You can redistribute or modify this code
# under the terms of Ruby's license.
require "test/unit"
require "test_csv_parsing"
require "test_features"
require "test_interfac... | Ruby |
#!/usr/bin/env ruby -w
# encoding: UTF-8
# tc_row.rb
#
# Created by James Edward Gray II on 2005-10-31.
# Copyright 2005 James Edward Gray II. You can redistribute or modify this code
# under the terms of Ruby's license.
require_relative "base"
class TestCSV::Row < TestCSV
extend DifferentOFS
def setup
s... | Ruby |
#!/usr/bin/env ruby -w
# encoding: UTF-8
# tc_encodings.rb
#
# Created by James Edward Gray II on 2008-09-13.
# Copyright 2008 James Edward Gray II. You can redistribute or modify this code
# under the terms of Ruby's license.
require_relative "base"
class TestCSV::Encodings < TestCSV
extend DifferentOFS
def... | Ruby |
#!/usr/bin/env ruby -w
# encoding: UTF-8
# tc_interface.rb
#
# Created by James Edward Gray II on 2005-10-31.
# Copyright 2005 James Edward Gray II. You can redistribute or modify this code
# under the terms of Ruby's license.
require_relative "base"
require "tempfile"
class TestCSV::Interface < TestCSV
extend ... | Ruby |
#!/usr/bin/env ruby -w
# encoding: UTF-8
# tc_csv_writing.rb
#
# Created by James Edward Gray II on 2005-10-31.
# Copyright 2005 James Edward Gray II. You can redistribute or modify this code
# under the terms of Ruby's license.
require_relative "base"
class TestCSV::Writing < TestCSV
extend DifferentOFS
def... | Ruby |
require 'test/unit'
require 'prime'
require 'stringio'
require 'timeout'
class TestPrime < Test::Unit::TestCase
# The first 100 prime numbers
PRIMES = [
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37,
41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83,
89, 97, 101, 103, 107, 109, 113, 127, 131,
137, 139, 149, ... | Ruby |
require 'test/unit'
require 'delegate'
class TestDelegateClass < Test::Unit::TestCase
module M
attr_reader :m
end
def test_extend
obj = DelegateClass(Array).new([])
obj.instance_eval { @m = :m }
obj.extend M
assert_equal(:m, obj.m, "[ruby-dev:33116]")
end
def test_systemcallerror_eq
... | Ruby |
require 'test/unit'
require 'open-uri'
require 'openssl'
require 'stringio'
require 'webrick'
require 'webrick/https'
require 'webrick/httpproxy'
class TestOpenURISSL < Test::Unit::TestCase
NullLog = Object.new
def NullLog.<<(arg)
end
def with_https
Dir.mktmpdir {|dr|
srv = WEBrick::HTTPServer.new(... | Ruby |
require 'test/unit'
require 'open-uri'
require 'webrick'
require 'webrick/httpproxy'
require 'zlib'
class TestOpenURI < Test::Unit::TestCase
NullLog = Object.new
def NullLog.<<(arg)
end
def with_http
Dir.mktmpdir {|dr|
srv = WEBrick::HTTPServer.new({
:DocumentRoot => dr,
:ServerType... | Ruby |
require 'tsort'
require 'test/unit'
class TSortHash < Hash # :nodoc:
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
class TSortArray < Array # :nodoc:
include TSort
alias tsort_each_node each_index
def tsort_each_child(node, &block)
... | Ruby |
require_relative "testbase"
require_relative "../ruby/envutil"
require 'thread'
class TestBigDecimal < Test::Unit::TestCase
include TestBigDecimalBase
ROUNDING_MODE_MAP = [
[ BigDecimal::ROUND_UP, :up],
[ BigDecimal::ROUND_DOWN, :down],
[ BigDecimal::ROUND_DOWN, :truncate],
[ Big... | Ruby |
require_relative "testbase"
require 'bigdecimal/util'
class TestBigDecimalUtil < Test::Unit::TestCase
def test_BigDecimal_to_d
x = BigDecimal(1)
assert_same(x, x.to_d)
end
def test_Integer_to_d
assert_equal(BigDecimal(1), 1.to_d)
assert_equal(BigDecimal(2<<100), (2<<100).to_d)
end
def test... | Ruby |
require "test/unit"
require "bigdecimal"
module TestBigDecimalBase
def setup
@mode = BigDecimal.mode(BigDecimal::EXCEPTION_ALL)
BigDecimal.mode(BigDecimal::EXCEPTION_ALL, true)
BigDecimal.mode(BigDecimal::EXCEPTION_UNDERFLOW, true)
BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, true)
BigDecimal.... | Ruby |
require_relative "testbase"
require "bigdecimal/math"
class TestBigMath < Test::Unit::TestCase
include TestBigDecimalBase
include BigMath
N = 20
PINF = BigDecimal("+Infinity")
MINF = BigDecimal("-Infinity")
NAN = BigDecimal("NaN")
def test_const
assert_in_delta(Math::PI, PI(N))
assert_in_delta(M... | Ruby |
# $Id: test_nowrite.rb 30787 2011-02-04 18:37:52Z nobu $
require 'fileutils'
require 'test/unit'
require_relative 'clobber'
class TestFileUtilsNoWrite < Test::Unit::TestCase
include FileUtils::NoWrite
include TestFileUtils::Clobber
def test_visibility
FileUtils::METHODS.each do |m|
assert_equal true... | Ruby |
require 'fileutils'
require 'test/unit'
require 'tmpdir'
require_relative 'fileasserts'
class TestFileUtils < Test::Unit::TestCase
end
module TestFileUtils::Clobber
include Test::Unit::FileAssertions
def my_rm_rf(path)
if File.exist?('/bin/rm')
system %Q[/bin/rm -rf "#{path}"]
else
FileUtils.... | Ruby |
# $Id: fileasserts.rb 30804 2011-02-06 03:13:08Z nobu $
module Test
module Unit
module FileAssertions
def _wrap_assertion
yield
end
def assert_same_file(from, to, message=nil)
_wrap_assertion {
assert_block("file #{from} != #{to}#{message&&': '}#{message||''}") {
... | Ruby |
# $Id: test_fileutils.rb 32709 2011-07-27 15:33:56Z naruse $
require 'fileutils'
require_relative 'fileasserts'
require 'pathname'
require 'tmpdir'
require 'test/unit'
class TestFileUtils < Test::Unit::TestCase
TMPROOT = "#{Dir.tmpdir}/fileutils.rb.#{$$}"
include Test::Unit::FileAssertions
end
prevdir = Dir.pwd
... | Ruby |
# $Id: test_verbose.rb 25189 2009-10-02 12:04:37Z akr $
require 'test/unit'
require 'fileutils'
class TestFileUtilsVerbose < Test::Unit::TestCase
include FileUtils::Verbose
def test_visibility
FileUtils::METHODS.each do |m|
assert_equal true, FileUtils::Verbose.respond_to?(m, true),
... | Ruby |
# $Id: test_dryrun.rb 30787 2011-02-04 18:37:52Z nobu $
require 'fileutils'
require 'test/unit'
require_relative 'clobber'
class TestFileUtilsDryRun < Test::Unit::TestCase
include FileUtils::DryRun
include TestFileUtils::Clobber
def test_visibility
FileUtils::METHODS.each do |m|
assert_equal true, F... | Ruby |
require 'test/unit'
require 'tmpdir'
begin
require 'sdbm'
rescue LoadError
end
class TestSDBM < Test::Unit::TestCase
def setup
@tmpdir = Dir.mktmpdir("tmptest_sdbm")
@prefix = "tmptest_sdbm_#{$$}"
@path = "#{@tmpdir}/#{@prefix}_"
assert_instance_of(SDBM, @sdbm = SDBM.new(@path))
end
def teardo... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMakerAtomFeed < TestCase
def test_supported?
assert(RSS::Maker.supported?("atom"))
assert(RSS::Maker.supported?("atom:feed"))
assert(RSS::Maker.supported?("atom1.0"))
assert(RSS::Maker.supported?("atom1.0:feed"))
asser... | Ruby |
require "rexml/document"
require "rss-testcase"
require "rss/1.0"
require "rss/xml-stylesheet"
module RSS
class TestXMLStyleSheet < TestCase
def test_accessor
[
{:href => "a.xsl", :type => "text/xsl"},
{:media => "print", :title => "FOO"},
{:charset => "UTF-8", :alternate => "yes... | Ruby |
require "rss-testcase"
require "rss/1.0"
require "rss/2.0"
require "rss/syndication"
require "rss/image"
module RSS
class TestAccessor < TestCase
def test_date
channel = Rss::Channel.new
channel.pubDate = nil
assert_nil(channel.pubDate)
time = Time.now
channel.pubDate = time
... | Ruby |
require "erb"
require "test/unit"
require 'rss-assertions'
require "rss"
module RSS
class TestCase < Test::Unit::TestCase
include ERB::Util
include RSS
include Assertions
XMLDECL_VERSION = "1.0"
XMLDECL_ENCODING = "UTF-8"
XMLDECL_STANDALONE = "no"
RDF_ABOUT = "http://www.xml.com/xml/... | Ruby |
require "cgi"
require "rexml/document"
require "rss-testcase"
require "rss/2.0"
require "rss/itunes"
module RSS
class TestITunes < TestCase
def test_author
assert_itunes_author(%w(channel)) do |content, xmlns|
make_rss20(make_channel20(content), xmlns)
end
assert_itunes_author(%w(ite... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestSetupMakerSlash < TestCase
def test_setup_maker
elements = {
"section" => "articles",
"department" => "not-an-ocean-unless-there-are-lobsters",
"comments" => 177,
"hit_parades" => [177, 155, 105, 33, 6, 3, 0],
... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestSetupMaker20 < TestCase
def test_setup_maker_channel
title = "fugafuga"
link = "http://hoge.com"
description = "fugafugafugafuga"
language = "ja"
copyright = "foo"
managingEditor = "bar"
webMaster = "web m... | Ruby |
require "rexml/document"
require "rss-testcase"
require "rss/1.0"
module RSS
class TestRSS10Core < TestCase
def setup
@rdf_prefix = "rdf"
@rdf_uri = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@uri = "http://purl.org/rss/1.0/"
end
def test_RDF
version = "1.0"
encoding ... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestSetupMakerAtomFeed < TestCase
def setup
t = Time.iso8601("2000-01-01T12:00:05+00:00")
class << t
alias_method(:to_s, :iso8601)
end
@dc_elems = {
:title => "hoge",
:description =>
" XML is p... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMakerXMLStyleSheet < TestCase
def test_xml_stylesheet
href = 'a.xsl'
type = 'text/xsl'
title = 'sample'
media = 'printer'
charset = 'UTF-8'
alternate = 'yes'
rss = RSS::Maker.make("1.0") do |maker|
... | Ruby |
require "rss-testcase"
require "rss/1.0"
module RSS
class TestInherit < TestCase
class InheritedImage < RSS::RDF::Image
def self.indent_size; 1; end
def self.tag_name; 'image'; end
end
def setup
@rss = make_RDF(<<-EOR)
#{make_channel}
#{make_image}
#{make_item}
#{make_textinput}
EOR
... | Ruby |
require 'erb'
module RSS
module Assertions
def _wrap_assertion
yield
end
def assert_parse(rss, assert_method, *args)
__send__("assert_#{assert_method}", *args) do
::RSS::Parser.parse(rss)
end
__send__("assert_#{assert_method}", *args) do
::RSS::Parser.parse(rss, f... | Ruby |
require "cgi"
require "rexml/document"
require "rss-testcase"
require "rss/1.0"
require "rss/slash"
module RSS
class TestSlash < TestCase
def setup
@elements = {
"section" => "articles",
"department" => "not-an-ocean-unless-there-are-lobsters",
"comments" => 177,
"hit_para... | Ruby |
require "rss-testcase"
require "rss/1.0"
require "rss/dublincore"
module RSS
class TestParser10 < TestCase
def test_RDF
assert_ns("", RDF::URI) do
Parser.parse(<<-EOR)
#{make_xmldecl}
<RDF/>
EOR
end
assert_ns("", RDF::URI) do
Parser.parse(<<-EOR)
#{make_xmldecl}
<RDF xmlns="ho... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestSetupMakerITunes < TestCase
def test_setup_maker_simple
author = "John Doe"
block = true
categories = ["Audio Blogs"]
image = "http://example.com/podcasts/everything/AllAboutEverything.jpg"
duration = "4:05"
dura... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMakerDublinCore < TestCase
def setup
@uri = "http://purl.org/dc/elements/1.1/"
t = Time.iso8601("2000-01-01T12:00:05+00:00")
class << t
alias_method(:to_s, :iso8601)
end
@elements = {
:title => "hoge... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMakerSlash < TestCase
def setup
@elements = {
"section" => "articles",
"department" => "not-an-ocean-unless-there-are-lobsters",
"comments" => 177,
"hit_parades" => [177, 155, 105, 33, 6, 3, 0],
}
end... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestSetupMaker09 < TestCase
def test_setup_maker_channel
title = "fugafuga"
link = "http://hoge.com"
description = "fugafugafugafuga"
language = "ja"
copyright = "foo"
managingEditor = "bar"
webMaster = "web m... | Ruby |
require "cgi"
require "rexml/document"
require "rss-testcase"
require "rss/1.0"
require "rss/syndication"
module RSS
class TestSyndication < TestCase
def setup
@prefix = "sy"
@uri = "http://purl.org/rss/1.0/modules/syndication/"
@parents = %w(channel)
t = Time.iso8601("2000-01-01T12:... | Ruby |
require "cgi"
require "rss-testcase"
require "rss/1.0"
require "rss/2.0"
require "rss/taxonomy"
module RSS
class TestTaxonomy < TestCase
def setup
@prefix = "taxo"
@uri = "http://purl.org/rss/1.0/modules/taxonomy/"
@dc_prefix = "dc"
@dc_uri = "http://purl.org/dc/elements/1.1/"
@... | Ruby |
require "fileutils"
require "rss-testcase"
require "rss/1.0"
require "rss/dublincore"
module RSS
class TestParser < TestCase
def setup
@_default_parser = Parser.default_parser
@rss10 = make_RDF(<<-EOR)
#{make_channel}
#{make_item}
#{make_textinput}
#{make_image}
EOR
@rss_file = "rss10.rdf"
... | Ruby |
require "rexml/document"
require "rss-testcase"
module RSS
class TestRSS20Core < TestCase
def setup
@rss_version = "2.0"
end
def test_Rss
version = "1.0"
encoding = "UTF-8"
standalone = false
rss = Rss.new(@rss_version, version, encoding, standalone)
setup_rss20(rs... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMakerImage < TestCase
def setup
@uri = "http://web.resource.org/rss/1.0/modules/image/"
@favicon_infos = {
"about" => "http://www.kuro5hin.org/favicon.ico",
"image_size" => "small",
"dc_title" => "example",
... | Ruby |
require "cgi"
require "rexml/document"
require "rss-testcase"
require "rss/1.0"
require "rss/dublincore"
module RSS
class TestDublinCore < TestCase
def setup
@rss10_parents = [%w(channel), %w(image), %w(item), %w(textinput)]
@rss10_source = make_RDF(<<-EOR, {DC_PREFIX => DC_URI})
#{make_channel(D... | Ruby |
require "rss-testcase"
require "rss/atom"
module RSS
class TestParserAtomFeed < TestCase
def test_feed_validation
assert_ns("", Atom::URI) do
Parser.parse(<<-EOA)
<feed/>
EOA
end
assert_ns("", Atom::URI) do
Parser.parse(<<-EOA)
<feed xmlns="hoge"/>
EOA
end
assert_... | Ruby |
require "rexml/document"
require "rss-testcase"
require "rss/atom"
module RSS
class TestAtomCore < TestCase
def setup
@uri = "http://www.w3.org/2005/Atom"
@xhtml_uri = "http://www.w3.org/1999/xhtml"
end
def test_feed
version = "1.0"
encoding = "UTF-8"
standalone = false
... | Ruby |
require "cgi"
require "rexml/document"
require "rss-testcase"
require "rss/content"
module RSS
class TestContent < TestCase
def setup
@prefix = "content"
@uri = "http://purl.org/rss/1.0/modules/content/"
@elems = {
:encoded => "<em>ATTENTION</em>",
}
@content_nodes = @el... | Ruby |
require "rss-testcase"
require "rss/atom"
module RSS
class TestParserAtom < TestCase
def test_entry_validation
assert_ns("", Atom::URI) do
Parser.parse(<<-EOA)
<entry/>
EOA
end
assert_ns("", Atom::URI) do
Parser.parse(<<-EOA)
<entry xmlns="hoge"/>
EOA
end
assert_p... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMakerITunes < TestCase
def test_author
assert_maker_itunes_author(%w(channel))
assert_maker_itunes_author(%w(items last))
end
def test_block
assert_maker_itunes_block(%w(channel))
assert_maker_itunes_block(%w(items ... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMaker09 < TestCase
def test_supported?
assert(RSS::Maker.supported?("0.9"))
assert(RSS::Maker.supported?("rss0.9"))
assert(RSS::Maker.supported?("0.91"))
assert(RSS::Maker.supported?("rss0.91"))
assert(RSS::Maker.suppo... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestSetupMaker10 < TestCase
def setup
t = Time.iso8601("2000-01-01T12:00:05+00:00")
class << t
alias_method(:to_s, :iso8601)
end
@dc_elems = {
:title => "hoge",
:description =>
" XML is placin... | Ruby |
require "rss-testcase"
module RSS
class TestVersion < TestCase
def test_version
assert_equal("0.2.7", ::RSS::VERSION)
end
end
end
| Ruby |
require "rexml/document"
require "rss-testcase"
require "rss/maker"
require "rss/1.0"
require "rss/2.0"
require "rss/content"
require "rss/dublincore"
require "rss/syndication"
require "rss/trackback"
module RSS
class TestToS < TestCase
def setup
@image_url = "http://example.com/foo.png"
@textinput... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestSetupMakerAtomEntry < TestCase
def setup
t = Time.iso8601("2000-01-01T12:00:05+00:00")
class << t
alias_method(:to_s, :iso8601)
end
@dc_elems = {
:title => "hoge",
:description =>
" XML is ... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMakerTrackBack < TestCase
def setup
@uri = "http://madskills.com/public/xml/rss/module/trackback/"
@elements = {
:ping => "http://bar.com/tb.cgi?tb_id=rssplustrackback",
:abouts => [
"http://foo.com/trackback... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMaker20 < TestCase
def test_supported?
assert(RSS::Maker.supported?("2.0"))
assert(RSS::Maker.supported?("rss2.0"))
assert(!RSS::Maker.supported?("2.2"))
assert(!RSS::Maker.supported?("rss2.2"))
end
def test_find_cl... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMakerSyndication < TestCase
def setup
@uri = "http://purl.org/rss/1.0/modules/syndication/"
t = Time.iso8601("2000-01-01T12:00:05+00:00")
class << t
alias_method(:to_s, :iso8601)
end
@elements = {
:u... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMakerTaxonomy < TestCase
def setup
@uri = "http://purl.org/rss/1.0/modules/taxonomy/"
@resources = [
"http://meerkat.oreillynet.com/?c=cat23",
"http://meerkat.oreillynet.com/?c=47",
"http://dmoz.org/Computers/D... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.