citrusbyte-milton 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -84,7 +84,7 @@ module Citrusbyte
84
84
 
85
85
  if data_or_path.is_a?(StringIO)
86
86
  tempfile.binmode
87
- tempfile.write data
87
+ tempfile.write data_or_path.read
88
88
  tempfile.close
89
89
  else
90
90
  tempfile.close
@@ -124,4 +124,27 @@ describe Citrusbyte::Milton::IsResizeable do
124
124
  @image.path(:size => '10x10', :crop => true).should =~ /\/#{Citrusbyte::Milton::AttachableFile.partition(@image.id)}\/milton.crop=true_size=10x10.jpg$/
125
125
  end
126
126
  end
127
+
128
+ describe "getting mime-type" do
129
+ before :each do
130
+ @image = Image.new :file => upload('milton.jpg')
131
+ end
132
+
133
+ describe "from freshly uploaded file" do
134
+ it "should recognize it as an image/jpg" do
135
+ @image.content_type.should eql('image/jpg')
136
+ end
137
+ end
138
+
139
+ describe "from existing file" do
140
+ before :each do
141
+ @image.save
142
+ @image.reload
143
+ end
144
+
145
+ it "should recognize it as an image/jpg" do
146
+ @image.content_type.should eql('image/jpg')
147
+ end
148
+ end
149
+ end
127
150
  end
@@ -53,6 +53,8 @@ describe Citrusbyte::Milton::IsUploadable do
53
53
  end
54
54
 
55
55
  it "should have the same filesize as original file when large enough not to be a StringIO" do
56
+ # FIXME: this doesn't actually upload as a StringIO, figure out how to
57
+ # force that
56
58
  @attachment.save
57
59
  File.size(@attachment.path).should be_eql(File.size(File.join(File.dirname(__FILE__), '..', 'fixtures', 'milton.jpg')))
58
60
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: citrusbyte-milton
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Alavi
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-27 00:00:00 -08:00
12
+ date: 2008-01-05 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15