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 6640783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:42:47+00:00 2026-05-25T23:42:47+00:00

This spec passes just fine on my CentOS development box, but fails when run

  • 0

This spec passes just fine on my CentOS development box, but fails when run on my Macbook (10.7).

app/models/issue.rb

class Issue < ActiveRecord::Base
  has_attached_file :cover_image,
    :styles => {
      :thumbnail => ["80x80>"],
      :large => ["600x600>"]
    },
    :path => ":rails_root/public/images/issues/:id/:style_:basename.:extension",
    :url => "issues/:id/:style_:basename.:extension"
  validates_attachment_content_type :cover_image, :content_type => ['image/jpeg', 'image/png']
  attr_protected :cover_image_file_name, :cover_image_content_type, :cover_image_file_size
end

spec/models/issue_spec.rb

require 'spec_helper'

describe Issue do
  it 'should not accept invalid image types' do
    %w[spec/factories/assets/docs/image.jpg spec/factories/assets/docs/image.txt].each do |file_path| #image.jpg is a text file with a .jpg extension
      issue = Factory.build(:issue, :cover_image => File.new(Rails.root + file_path))
      issue.should have(2).errors_on(:cover_image)
    end
  end
end

On my CentOS development box, I get no failures when I run the test. On my Macbook I get this error:

Failure/Error: issue.should have(2)errors_on(:cover_image)
  expected 2 errors on :cover_image, got 0

On both machines if I try to create an issue by uploading one of the invalid image types in a browser, it fails with the error message I expect and passes if I use a valid image type.

paperclip-2.4.2
rspec-2.6.0
factory_girl_rails-1.2.0

CentOS: ImageMagick-6.2.8 (yum package)
Mac OS X: ImageMagick-6.7.2-0 (Macports)
  • 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-25T23:42:47+00:00Added an answer on May 25, 2026 at 11:42 pm

    It seems my whole approach to testing paperclip was off.

    Paperclip Shoulda Matchers are working on both machines.

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

Sidebar

Related Questions

Or am I misunderstanding something? Partial lives in: app/views/admin/command_templates/_fillerup.html.erb This spec passes (there is
Is there a better way to write this spec? This works but I don't
I'm sure this information is available in the C# spec, but I thought I'd
I am trying to run rspec in my rails app using the spec command-
This is what my spec file looks like: spec/api/v1/projects_spec.rb require spec_helper describe /api/v1/projects, :type
I'm using this coffeescript code: in a spec file: index = new MeetingIndex(render: false,
The HTML spec shows the disabled and checked attributes for input elements like this:
Hi I have a file try.SPEC. This file contains a word Version: 1.0.0.1 .
This might be the exact opposite of this question . Consider the following spec:
This below app saves some data to the db and I want to test

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.