Sha256: 040e49d208b6aa920e7353d28a6030e414a3078e59dfd1ebca752345bf566291

Contents?: true

Size: 1001 Bytes

Versions: 6

Compression:

Stored size: 1001 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')


describe "JBundle::Server" do
  
  before do
    f = File.join(File.expand_path(File.dirname(__FILE__)), 'JFile')
    @server = JBundle::Server.new(f)
  end
  
  describe '#call' do
    before do      
      @response = @server.call({'PATH_INFO' => '/foo.js'})
    end
    
    it 'should be 404 if no JFile found' do
      s = JBundle::Server.new("doesn-not-exist")
      r = s.call({'PATH_INFO' => '/foo.js'})
      r[0].should == 404
    end
    
    it 'should be 200 OK' do
      @response[0].should == 200
    end
    
    it 'should be a javascript response' do
      @response[1]['Content-Type'].should == 'application/x-javascript'
    end
    
    it 'should return content for given bundle' do
      @response[2].should == [JBundle.build('foo.js').src]
    end
    
    it 'should be 404 when no bundle found' do
      r = @server.call({'PATH_INFO' => '/nonexisting.js'})
      r[0].should == 404
    end
    
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jbundle-0.1.2 spec/server_spec.rb
jbundle-0.1.1 spec/server_spec.rb
jbundle-0.1.0 spec/server_spec.rb
jbundle-0.0.12 spec/server_spec.rb
jbundle-0.0.11 spec/server_spec.rb
jbundle-0.0.10 spec/server_spec.rb