<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -227,7 +227,7 @@ module AssetTags
     attributes = options.inject('') { |s, (k, v)| s &lt;&lt; %{#{k.downcase}=&quot;#{v}&quot; } }.strip
     attributes = &quot; #{attributes}&quot; unless attributes.empty?
     text = tag.double? ? tag.expand : text
-    url = asset.image? ? asset.thumbnail(size) : asset.asset.url
+    url = asset.thumbnail(size)
     %{&lt;a href=&quot;#{url  }#{anchor}&quot;#{attributes}&gt;#{text}&lt;/a&gt;} rescue nil
   end
   </diff>
      <filename>app/models/asset_tags.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,11 +1,68 @@
 require File.dirname(__FILE__) + '/../spec_helper'
 
 describe Asset do
-  before(:each) do
-    @asset = Asset.make
+  def default_attributes
+    {
+      :asset_file_name =&gt;  'asset.jpg',
+      :asset_content_type =&gt;  'image/jpeg',
+      :asset_file_size =&gt; '46248'
+    }
   end
-
-  it &quot;should be valid&quot; do
-    @asset.should be_valid
+  def new_asset(overrides={})
+    Asset.new default_attributes.merge(overrides)
+  end
+  def create_asset(overrides={})
+    Asset.create! default_attributes.merge(overrides)
+  end
+  
+  it 'should be valid when instantiated' do
+    new_asset.should be_valid
   end
+  
+  it 'should be valid when saved' do
+    create_asset.should be_valid
+  end
+  
+  describe '#thumbnail' do
+    describe 'without argument' do
+      it 'should return paperclip asset url for image' do
+        image = new_asset :asset_content_type =&gt; 'image/jpeg'
+        image.stub! :asset =&gt; mock('asset', :url =&gt; '/y/z/e.jpg')
+        image.thumbnail.should == '/y/z/e.jpg'
+      end
+      
+      it 'should return paperclip asset url for non-image' do
+        asset = new_asset :asset_content_type =&gt; 'application/pdf'
+        asset.stub! :asset =&gt; mock('asset', :url =&gt; '/y/z/e.pdf')
+        asset.thumbnail.should == '/y/z/e.pdf'
+      end
+    end
+    
+    describe 'with size=original' do
+      it 'should return paperclip asset url for image' do
+        image = new_asset :asset_content_type =&gt; 'image/jpeg'
+        image.stub! :asset =&gt; mock('asset', :url =&gt; '/y/z/e.jpg')
+        image.thumbnail('original').should == '/y/z/e.jpg'
+      end
+      
+      it 'should return paperclip asset url for non-image' do
+        asset = new_asset :asset_content_type =&gt; 'application/pdf'
+        asset.stub! :asset =&gt; mock('asset', :url =&gt; '/y/z/e.pdf')
+        asset.thumbnail('original').should == '/y/z/e.pdf'
+      end
+    end
+    
+    it 'should return resized image for images when given size' do
+      image = new_asset :asset_content_type =&gt; 'image/jpeg'
+      image.stub! :asset =&gt; mock('asset')
+      image.asset.stub!(:url).with(:thumbnail).and_return('/re/sized/image_thumbnail.jpg')
+      image.thumbnail('thumbnail').should == '/re/sized/image_thumbnail.jpg'
+    end
+    
+    it 'should return icon for non-image with a given size' do
+      image = new_asset :asset_content_type =&gt; 'application/pdf'
+      image.thumbnail('thumbnail').should == &quot;/images/assets/pdf_thumbnail.png&quot;
+    end
+  end
+
 end</diff>
      <filename>spec/models/asset_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,10 +6,10 @@ end
 
 require 'spec/rails'
 
-require File.expand_path(File.dirname(__FILE__) + &quot;/blueprints&quot;)
+# require File.expand_path(File.dirname(__FILE__) + &quot;/blueprints&quot;)
 
 Spec::Runner.configure do |config|
-  # config.use_transactional_fixtures = true
+  config.use_transactional_fixtures = true
   # config.use_instantiated_fixtures  = false
   # config.fixture_path = RAILS_ROOT + '/spec/fixtures'
 </diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>08581bd3d79b80e7c174ea5288316bf45a80d995</id>
    </parent>
    <parent>
      <id>dd09602a1ff50a836b9f26300e4bd7c6f1e9471d</id>
    </parent>
  </parents>
  <author>
    <name>Keith</name>
    <email>keith@keithbingman.com</email>
  </author>
  <url>http://github.com/kbingman/paperclipped/commit/bb79377f50534719a495fe662bc44bd84e6d5fcf</url>
  <id>bb79377f50534719a495fe662bc44bd84e6d5fcf</id>
  <committed-date>2009-07-10T02:07:06-07:00</committed-date>
  <authored-date>2009-07-10T02:07:06-07:00</authored-date>
  <message>added gerrits #thumbnail fixes</message>
  <tree>c763658d109a1b926221b571ad0794de3bbde231</tree>
  <committer>
    <name>Keith</name>
    <email>keith@keithbingman.com</email>
  </committer>
</commit>
