spec/unit/has_attachment_spec.rb in bulldog-0.2.3 vs spec/unit/has_attachment_spec.rb in bulldog-0.2.4
- old
+ new
@@ -27,11 +27,11 @@
end
Thing.attachment_reflections[:photo].styles[:one].should_not be_blank
Thing.attachment_reflections[:photo].styles[:two].should_not be_blank
end
- describe "when an attachment is inherited" do
+ describe "when an attachment is extended in a subclass" do
use_model_class(:Parent)
before do
# Create the attachment before subclassing
Parent.has_attachment :photo do
@@ -39,15 +39,24 @@
end
end
use_model_class(:Child => :Parent)
- it "should not affect the superclasses' attachment" do
+ before do
Child.has_attachment :photo do
style :two
end
+ end
+
+ it "should not affect the superclasses' attachment" do
Child.attachment_reflections[:photo].styles[:two].should_not be_blank
Parent.attachment_reflections[:photo].styles[:two].should be_blank
+ end
+
+ it "should not define accessors in the subclass, so alias_method_chain can be used in the abstract class" do
+ Child.public_instance_methods(false).map{|s| s.to_sym}.should_not include(:photo)
+ Child.public_instance_methods(false).map{|s| s.to_sym}.should_not include(:photo=)
+ Child.public_instance_methods(false).map{|s| s.to_sym}.should_not include(:photo?)
end
end
end
describe "assigning to an attachment" do