Sha256: 0938bc608d5714bd96e6a11ab508572d400efa4cca26accf6cb6ffe5fe75ea36

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'
require 'tempfile'

module CiteProc
  module JS
    
    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
          Style.root = root
          Style.extension = extension
        end
      
        describe '.load' do  
        
          it 'accepts an absolute file name' do
            Style.load(file.path).to_s.should == "asset content\n"
          end

          it 'accepts a file name' do
            Style.load(name).to_s.should == "asset content\n"
          end

          # it 'accepts a file name without extension' do
          #   Style.load(name.sub(/#{extension}$/,'')).to_s.should == "asset content\n"
          # end
          # 
          # 
          # it 'accepts a uri' do
          #   pending
          # end
        
          it 'returns the given string if it is neither file nor uri' do
            Style.load('foo bar!').to_s.should == 'foo bar!'
          end
        
        end
      
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
citeproc-js-0.0.1 spec/citeproc/js/assets_spec.rb