Skip to content

Commit

Permalink
Remove passing an array of variant classes for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
alloy committed Nov 25, 2009
1 parent 097ac45 commit 02b435c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 27 deletions.
4 changes: 2 additions & 2 deletions lib/attachment_san/has.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def define_variants(name, options)
model.send(:define_variant, :original, original)

if variants = options[:variants]
variants.each do |name, options|
model.send(:define_variant, name, options)
variants.each do |name, variant_options|
model.send(:define_variant, name, variant_options)
end
end
end
Expand Down
16 changes: 0 additions & 16 deletions test/fixtures/models/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,6 @@ def initialize(variant); end
end

class Document < ActiveRecord::Base
class AddressCard < Attachment
class SmallCard < AttachmentSan::Variant
def process!
puts 'SMALL!'
end
end

class BigCard < AttachmentSan::Variant
def process!
puts 'BIG!'
end
end
end

has_attachment :watermark
has_attachment :logo, :variants => { :header => MyVariant }

Expand All @@ -34,8 +20,6 @@ def process!
:medium_sized => proc {},
:download => proc {}
}

has_attachments :address_cards, :variants => [:small_card, :big_card]
end

class OtherDocument < ActiveRecord::Base
Expand Down
9 changes: 0 additions & 9 deletions test/has_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,4 @@
Document::MiscFile.variant_reflections.first[:filename_scheme].should == :keep_original
Document::MiscFile.variant_reflections.first[:process].call.should == :from_process_proc
end
end

describe "AttachmentSan::Has, concerning attachment definitions with an array of variants" do
it "should simply assume the variant class exists" do
@document = Document.new
card = @document.address_cards.build(:uploaded_file => rails_icon)
card.small_card.should.be.instance_of Document::AddressCard::SmallCard
card.big_card.should.be.instance_of Document::AddressCard::BigCard
end
end

0 comments on commit 02b435c

Please sign in to comment.