Created
June 24, 2013 16:48
-
-
Save m3talsmith/5851553 to your computer and use it in GitHub Desktop.
An example of an attachment upload paperclip test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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