Sha256: d665db5df5ff43e36fc767015fc744c15f07b50c5b08f51c33429b445d5d12c1
Contents?: true
Size: 1.63 KB
Versions: 13
Compression:
Stored size: 1.63 KB
Contents
module CiteProc describe 'Assets' do let(:file) { Tempfile.new('asset') } let(:root) { File.dirname(file.path) } let(:name) { File.basename(file.path) } let(:extension) { File.extname(name) } before(:all) do file.write("asset content\n") file.close end after(:all) { file.unlink } describe 'Style' do before(:all) do @default_root = Style.root @default_extension = Style.extension Style.root = root Style.extension = extension end after(:all) do Style.root = @default_root Style.extension = @default_extension end it 'should not be open by default' do Style.new.should_not be_open end describe '.open' do it 'accepts an absolute file name' do Style.open(file.path).to_s.should == "asset content\n" end it 'accepts a file name' do Style.open(name).to_s.should == "asset content\n" end it 'accepts a file name without extension' do Style.open(name.sub(/#{extension}$/,'')).to_s.should == "asset content\n" end it 'accepts an io object' do Style.open(file.open).to_s.should == "asset content\n" end it 'returns the given string if it looks like XML' do Style.open('<b>foo bar!</b>').to_s.should == '<b>foo bar!</b>' end end describe '.extend_name' do it 'adds the default extension if the file does not already end with it' do Style.extend_name(name.sub(/#{extension}$/,'')).should == name end it 'does not add the default extension if the file already ends with it' do Style.extend_name(name).should == name end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems