Skip to content

Instantly share code, notes, and snippets.

@m3talsmith
Created June 24, 2013 16:48
Show Gist options
  • Save m3talsmith/5851553 to your computer and use it in GitHub Desktop.
Save m3talsmith/5851553 to your computer and use it in GitHub Desktop.
An example of an attachment upload paperclip test.
require 'spec_helper'
describe Manage::Collections::AssetsController do
use_vcr_cassette
let!(:collection) {FactoryGirl.create :collection}
let!(:employee) {FactoryGirl.create :employee}
it 'creates an asset' do
collection.header.should_not be
post :create, format: :json, pin: employee.pin, collection_id: collection.id, asset: {image: fixture_file_upload('spec/assets/test-image.jpg', 'image/jpg')}
collection.reload
collection.header.should be
json = JSON.parse(response.body)
json['url'].should == collection.assets.first.image.url(:original)
end
it 'removes an asset'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment