Sha256: 680e2ee5e6c2da1abd9235727b2af6d8ff3e990c2842c3d3ab6c99b5fc126f3b

Contents?: true

Size: 793 Bytes

Versions: 2

Compression:

Stored size: 793 Bytes

Contents

# -*- coding: utf-8 -*-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe Kindai::BookDownloader, 'with book which contains slash in title' do
  before do
    @book = Kindai::Book.new_from_permalink('http://kindai.ndl.go.jp/info:ndljp/pid/1057420')
    @downloader   = Kindai::BookDownloader.new_from_book(@book)
  end

  describe 'safe_filename' do
    it 'convert path separator to _' do
      @downloader.safe_filename('a/b').should == 'a_b'
      @downloader.safe_filename('a/b/c/d').should == 'a_b_c_d'
    end
  end

  it 'has base path' do
    @downloader.base_path = "/path/to/library"
    @downloader.book_path.should == "/path/to/library/BMW航空発動機会社 [著]三菱商事株式会社機械部 訳編 - BMW132Dc_1型発動機部品表"
  end
end



Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kindai-2.8.0 spec/book_downloader_with_book_with_slash_spec.rb
kindai-2.7.0 spec/book_downloader_with_book_with_slash_spec.rb