Generate a dummy image file for development
Add this line to your application's Gemfile:
group :development, :test do
gem 'dummy_magick'
end
And then execute:
$ bundle
##
# Generate a dummy image file
#
# @param width [Integer] The width of the image.
# @param height [Integer] The height of the image.
# @param format [String] The file extension of the image format. Like 'jpg', 'png', 'gif' etc.
# @return [File]
DummyMagick.dummy_image_file(100, 100, :png)
class User < ActiveRecord::Base
mount_uploader :avatar, AvatarUploader
end
User.new
User.avator = DummyMagick.dummy_image_file(100, 100, :png)
User.save!
image_file = DummyMagick.dummy_image_file(100, 100, :png)
post :create, avatar: fixture_file_upload(image_file.path, 'image/png')
image_file = DummyMagick.dummy_image_file(100, 100, :png)
attach_file 'Upload file', image_file.path
- Fork it ( https://github.com/unosk/dummy_magick/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request