class ConfigureTest

Public Instance Methods

setup() click to toggle source
# File ../../../../../test/test_configure.rb, line 8
def setup
  @maker = ReVIEW::EPUBMaker.new
  @config = ReVIEW::Configure.values
  @config.merge!({
                   "bookname" => "sample",
                   "title" => "Sample Book",
                   "version" => 2,
                   "urnid" => "http://example.jp/",
                   "date" => "2011-01-01",
                   "language" => "ja",
                   "epubmaker" => {"flattocindent" => true,
                                   "title" => "Sample Book(EPUB)"},
                 })
  @output = StringIO.new
  I18n.setup(@config["language"])
end
test_check_version() click to toggle source
# File ../../../../../test/test_configure.rb, line 71
def test_check_version
  @config["review_version"] = "2.1"
  assert_nothing_raised do
    @config.check_version("2.1.0")
  end
  assert_nothing_raised do
    @config.check_version("2.2.0")
  end
  assert_nothing_raised do
    @config.check_version("2.2.5")
  end
  assert_raise ReVIEW::ConfigError do
    @config.check_version("2.0.0")
  end
  assert_raise ReVIEW::ConfigError do
    @config.check_version("3.0.0")
  end
  assert_raise ReVIEW::ConfigError do
    @config.check_version("1.8.0")
  end
end
test_check_version_nosetting() click to toggle source
# File ../../../../../test/test_configure.rb, line 57
def test_check_version_nosetting
  @config.delete("review_version")
  assert_raise ReVIEW::ConfigError do
    @config.check_version("2.0.0")
  end
end
test_check_version_noversion() click to toggle source
# File ../../../../../test/test_configure.rb, line 64
def test_check_version_noversion
  @config["review_version"] = nil
  assert_nothing_raised ReVIEW::ConfigError do
    @config.check_version("2.0.0")
  end
end
test_configure_class() click to toggle source
# File ../../../../../test/test_configure.rb, line 25
def test_configure_class
  assert_equal ReVIEW::Configure, @config.class
end
test_configure_get() click to toggle source
# File ../../../../../test/test_configure.rb, line 29
def test_configure_get
  bookname = @config["bookname"]
  assert_equal "sample", bookname
end
test_configure_get2() click to toggle source
# File ../../../../../test/test_configure.rb, line 34
def test_configure_get2
  assert_equal true, @config["epubmaker"]["flattocindent"]
end
test_configure_with_invalidmaker() click to toggle source
# File ../../../../../test/test_configure.rb, line 51
def test_configure_with_invalidmaker
  @config.maker = "pdfmaker"
  assert_equal nil, @config["flattocindent"]
  assert_equal true, @config["epubmaker"]["flattocindent"]
end
test_configure_with_maker() click to toggle source
# File ../../../../../test/test_configure.rb, line 38
def test_configure_with_maker
  @config.maker = "epubmaker"
  assert_equal true, @config["flattocindent"]
  assert_equal true, @config["epubmaker"]["flattocindent"]
end
test_configure_with_maker_override() click to toggle source
# File ../../../../../test/test_configure.rb, line 44
def test_configure_with_maker_override
  @config.maker = "epubmaker"
  assert_equal "Sample Book(EPUB)", @config["title"]
  @config.maker = "pdfmaker"
  assert_equal "Sample Book", @config["title"]
end