-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf8f573
commit d30d554
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require 'spec_helper' | ||
require 'carrierwave/test/matchers' | ||
|
||
describe PictureUploader do | ||
include CarrierWave::Test::Matchers | ||
|
||
let(:picture) { FactoryGirl.create(:picture) } | ||
|
||
before do | ||
PictureUploader.enable_processing = true | ||
picture.process_image_upload = true | ||
@uploader = PictureUploader.new(picture, :image) | ||
@uploader.thumb.enable_processing = true | ||
path = Rails.root.join('app', 'assets', 'images', 'imgs', 'avatar-placeholder.png') | ||
@uploader.store!(File.open path) | ||
end | ||
|
||
after do | ||
PictureUploader.enable_processing = false | ||
@uploader.remove! | ||
end | ||
|
||
it { expect(subject.extension_white_list).to eq ['jpg', 'jpeg', 'png'] } | ||
|
||
context 'the thumb version' do | ||
it "should scale down a landscape image to be exactly 240 by 200 pixels" do | ||
expect(@uploader.thumb).to be_no_larger_than(240, 200) | ||
end | ||
end | ||
end |