bulldog 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.2.4 2011-01-07
2
+
3
+ * Support alias_method_chain on base attachments when extended in
4
+ subclasses.
5
+
1
6
  == 0.2.3 2011-01-06
2
7
 
3
8
  * #process accepts an :input_file option.
@@ -13,9 +13,11 @@ module Bulldog
13
13
 
14
14
  reflection = attachment_reflections[name] || Reflection.new(self, name)
15
15
  reflection.configure(&block)
16
- attachment_reflections[name] = reflection
17
- define_attachment_accessors(reflection.name)
18
- define_attachment_attribute_methods(reflection.name)
16
+ unless attachment_reflections.key?(name)
17
+ attachment_reflections[name] = reflection
18
+ define_attachment_accessors(reflection.name)
19
+ define_attachment_attribute_methods(reflection.name)
20
+ end
19
21
  end
20
22
 
21
23
  module InstanceMethods
@@ -1,5 +1,5 @@
1
1
  module Bulldog
2
- VERSION = [0, 2, 3]
2
+ VERSION = [0, 2, 4]
3
3
 
4
4
  class << VERSION
5
5
  include Comparable
@@ -29,7 +29,7 @@ describe HasAttachment do
29
29
  Thing.attachment_reflections[:photo].styles[:two].should_not be_blank
30
30
  end
31
31
 
32
- describe "when an attachment is inherited" do
32
+ describe "when an attachment is extended in a subclass" do
33
33
  use_model_class(:Parent)
34
34
 
35
35
  before do
@@ -41,13 +41,22 @@ describe HasAttachment do
41
41
 
42
42
  use_model_class(:Child => :Parent)
43
43
 
44
- it "should not affect the superclasses' attachment" do
44
+ before do
45
45
  Child.has_attachment :photo do
46
46
  style :two
47
47
  end
48
+ end
49
+
50
+ it "should not affect the superclasses' attachment" do
48
51
  Child.attachment_reflections[:photo].styles[:two].should_not be_blank
49
52
  Parent.attachment_reflections[:photo].styles[:two].should be_blank
50
53
  end
54
+
55
+ it "should not define accessors in the subclass, so alias_method_chain can be used in the abstract class" do
56
+ Child.public_instance_methods(false).map{|s| s.to_sym}.should_not include(:photo)
57
+ Child.public_instance_methods(false).map{|s| s.to_sym}.should_not include(:photo=)
58
+ Child.public_instance_methods(false).map{|s| s.to_sym}.should_not include(:photo?)
59
+ end
51
60
  end
52
61
  end
53
62
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulldog
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 3
10
- version: 0.2.3
9
+ - 4
10
+ version: 0.2.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - George Ogata
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-06 00:00:00 -05:00
18
+ date: 2011-01-07 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency