Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7072207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:46:50+00:00 2026-05-28T05:46:50+00:00

I’m making a rails 3.1 app using carrierwave to upload files to aws s3.

  • 0

I’m making a rails 3.1 app using carrierwave to upload files to aws s3. I’ve followed the instructions on the carrierwave github repository and am now able to upload files to my aws bucket. It’s the testing that got me stuck.

Over the last two days I’ve been googling and revising, using all the other Q&A’s I’ve found but am finally crying ‘mama.’ Here’s what I’ve got:

/app/uploaders/image_file_uploader.rb

storage :fog

def store_dir
  "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end

/config/initializers/carrierwave.rb

if Rails.env.test? or Rails.env.cucumber?
  CarrierWave.configure do |config|
    config.storage = :file
    config.enable_processing = false
  end
end

/spec/uploaders/image_file_uploader_spec.rb

require 'spec_helper'
require 'support/fog_helper'
require 'carrierwave/test/matchers'

describe ImageFileUploader do
  include CarrierWave::Test::Matchers

  before do
    ImageFileUploader.enable_processing = true
    @user = Factory(:user, :email => "photo_taker@example.edu")
    @uploader = ImageFileUploader.new(@user, Factory(:image))
    @uploader.store!(File.open("#{Rails.root}/tmp/uploads/#{Rails.env}/images/"))
  end

  after do
    @uploader.remove!
    ImageFileUploader.enable_processing = false
  end

  context 'the tiny version' do
    it "should scale down a landscape image to be exactly 50 by 50 pixels" do
      @uploader.tiny.should have_dimensions(50, 50)
    end
  end

spec/factories.rb

Factory.define :image do |image|
  include ActionDispatch::TestProcess
  
  image.date_taken            "Sun, 09 Oct 2011"
  image.time_taken            "2000-01-01 03:41:00 UTC"
  image.image_file            fixture_file_upload('spec/support/test_images/audi.png', 'image/png')
  image.taken_by              "John Doe"
  image.collection            "N/A"
  image.comments              "Beautiful day!"
  image.association   :user

end

While my /public/uploads/tmp/ is getting filled up with ‘tiny’ (and other versions) of the images whose generation I am testing, the tests continue to fail with the following error message:

  1. ImageFileUploader the tiny version should scale down a landscape image to be exactly 50 by 50 pixels
     Failure/Error: @uploader = ImageFileUploader.new(@user, Factory(:image))
     Excon::Errors::NotFound:
       Expected(200) <=> Actual(404 Not Found)
         request => {:expects=>200}
         response => #<Excon::Response:0x0000010569f928 @body="", @headers={}, @status=404>
     # ./spec/uploaders/image_file_uploader_spec.rb:11:in `block (2 levels) in <top (required)>'

I know that the above means that rspec isn’t finding my testing bucket. Anyone have any thoughts about what I’m doing wrong?

would be super grateful for any new leads.

UPDATE: 10/11/11
The file upload works but I’ve stalled in figuring out how to get test involving the images to pass. In the short term, I will use a placeholder image as I flesh out the rest of my app and return to this later. I’ll post a further update once I figure this out. (Do leave any thoughts if you have any insights, however.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:46:50+00:00Added an answer on May 28, 2026 at 5:46 am

    Have you tried this?

    1. In /app/uploaders/image_file_uploader.rb remove storage :fog

    2. In /config/initializers/carrierwave.rb add a similar configuration block for production as you have for test and cucumber, and set config.storage = :fog there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I am using Paperclip to handle profile photo uploads in my app. They upload
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.