Sha256: 6479474ca0095276ba9928b9eb40477ee83c5ca52cc7505c00abcfe1d2f046f5

Contents?: true

Size: 1.56 KB

Versions: 2

Compression:

Stored size: 1.56 KB

Contents

require 'test_helper'

class PageGlimpseTest < Test::Unit::TestCase
  
  context 'PageGlimpse' do
    
    context 'exists?' do
      
      should 'be true for thumbnails which exist' do
        assert PageGlimpse.exists?('http://goodurl.local/', :size => 'large')
      end

      should 'be false for thumbnails which do not exist' do
        assert !PageGlimpse.exists?('http://badurl.local/', :size => 'large')
      end
      
    end
    
    context 'get' do
      
      context 'with a thumbnail available' do
        
        setup do
          @thumbnail = PageGlimpse.get('http://goodurl.local/', :size => 'large')
        end
        
        should 'return an Image' do
          assert_kind_of PageGlimpse::Image, @thumbnail
        end

        should 'have a content type' do
          assert_equal 'image/jpeg', @thumbnail.content_type
        end

        should 'have a content length' do
          assert_equal 3124, @thumbnail.content_length
        end

        should 'have content' do
          assert_not_nil @thumbnail.content
        end

        should 'have a filename' do
          assert_equal 'invalid_devkey.150x108.jpg', @thumbnail.filename
        end
        
      end
      
      context 'with no thumbnail available' do
        
        should 'return nil' do
          assert_nil PageGlimpse.get('http://badurl.local/', :size => 'large')
        end
        
      end
      
    end
    
    context 'queue' do
      
      should 'return true' do
        assert PageGlimpse.queue('http://goodurl.local/')
      end
      
    end
    
  end
  
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
nbibler-page_glimpse-0.0.1 test/integrations/page_glimpse_test.rb
page_glimpse-0.0.1 test/integrations/page_glimpse_test.rb