Attachment_fu model Spec for RSpec

OKJSP에 남겨놨던 글을 좀 자세하게 블로그에 정리.

환경은 다음과 같다.

  • Ruby on Rails 2.0.2
  • RSpec 1.1.3
  • Spec::Rails 1.1.3
  • Attachment_fu 2008-03-17

사실 원래 목적은, 이번 플젝을 진행하면서 소소하게 BDD를 적용해 보다가, Plugin으로 처리되는 파일 업로드를 위한 Spec 파일을 만드는것.

역시나 언제나 처럼 구글에는 개발할 때 필요한 거의 모든게 있다. ^^

require File.dirname(__FILE__) + '/../spec_helper'

describe ArticleImage do
  before(:all) do
    SAMPLE_FILE = RAILS_ROOT + '/tmp/rails.png'

    @article_image = ArticleImage.new
    @article_image.uploaded_data =
      ActionController::TestUploadedFile.new(SAMPLE_FILE, 'image/png')
    @article_image.send :process_attachment
  end

  it "should be valid" do
    @article_image.should be_valid
  end
end

This entry was posted on Tue, 22 Apr 2008 14:36:00 GMT and Posted in . You can follow any any response to this entry through the Atom feed. You can leave a comment or a trackback from your own site.
Tags , , ,


Trackbacks

Use the following link to trackback from your own site:
http://blog.funspaces.org/trackbacks?article_id=attachment_fu-model-spec-for-rspec&day=22&month=04&year=2008

Comments

Leave a response

Leave a comment