Created
March 6, 2011 21:59
-
-
Save ngw/857736 to your computer and use it in GitHub Desktop.
This file contains 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
class Design | |
include Mongoid::Document | |
include Mongoid::Slug | |
mount_uploader :thumbnail, ThumbnailUploader | |
mount_uploader :screenshot, ScreenshotUploader | |
field :url, :type => String | |
field :client, :type => String | |
field :client_response, :type => String | |
field :deliverables, :type => Array | |
field :case_study, :type => String | |
slug :id, :client, :as => :slug, :index => true | |
embedded_in :users | |
validates_presence_of :url | |
end | |
###### | |
# encoding: utf-8 | |
class ScreenshotUploader < CarrierWave::Uploader::Base | |
include CarrierWave::MiniMagick | |
storage :s3 | |
def s3_bucket | |
"designs.stylej.am" | |
end | |
def store_dir | |
"#{ model.id }/#{ mounted_as }" | |
end | |
version :one_half do | |
process :resize_to_fill => [ 480, 480 ] | |
end | |
version :one_third do | |
process :resize_to_fill => [ 320, 320 ] | |
end | |
version :one_fourth do | |
process :resize_to_fill => [ 240, 240 ] | |
end | |
def extension_white_list | |
%w(jpg jpeg gif png) | |
end | |
end | |
##### | |
When /^I fill all the data required$/ do | |
fill_in "design[url]", :with => 'http://example.com' | |
attach_file "design[screenshot]", File.join( Rails.root, 'spec', 'fixtures', 'test.jpg' ) | |
fill_in "design[client]", :with => 'Example Inc.' | |
fill_in "design[client_response]", :with => 'Pretty cool dude' | |
fill_in "design[case_study]", :with => 'Been there done that' | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment