property 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  .DS_Store
2
2
  coverage
3
3
  *.gem
4
- log/test.log
4
+ log/test.log
5
+ .project
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.2.0 2010-09-26
2
+
3
+ * Major enhancements
4
+ * Fixed nasty bug preventing 'name' properties in roles.
5
+
1
6
  == 1.1.0 2010-07-22
2
7
 
3
8
  * Major enhancements
@@ -130,12 +130,14 @@ module Property
130
130
 
131
131
  def check_duplicate_method_definitions(role, keys)
132
132
  common_keys = []
133
+ # we are in an instance's metaclass, find the class
134
+ superclass = @binding.ancestors.detect {|a| a.kind_of?(Class)}
133
135
  keys.each do |k|
134
- common_keys << k if @binding.superclass.method_defined?(k)
136
+ common_keys << k if superclass.method_defined?(k)
135
137
  end
136
138
 
137
139
  if !common_keys.empty?
138
- raise RedefinedMethodError.new("Cannot include role '#{role.name}' in '#{@binding}'. Would hide methods in superclass: #{common_keys.join(', ')}")
140
+ raise RedefinedMethodError.new("Cannot include role '#{role.name}' in '#{@binding}'. Would hide methods in superclass (#{superclass}): #{common_keys.join(', ')}")
139
141
  end
140
142
  end
141
143
 
@@ -1,3 +1,3 @@
1
1
  module Property
2
- VERSION = '1.1.0'
2
+ VERSION = '1.2.0'
3
3
  end
data/property.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{property}
8
- s.version = "1.1.0"
8
+ s.version = "1.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Renaud Kern", "Gaspard Bucher"]
12
- s.date = %q{2010-07-22}
12
+ s.date = %q{2010-09-26}
13
13
  s.description = %q{Wrap model properties into a single database column and declare properties from within the model.}
14
14
  s.email = %q{gaspard@teti.ch}
15
15
  s.extra_rdoc_files = [
@@ -77,6 +77,26 @@ class DeclarationTest < Test::Unit::TestCase
77
77
  end
78
78
  end
79
79
  end
80
+
81
+ context 'An instance' do
82
+ subject do
83
+ Class.new(ActiveRecord::Base) do
84
+ set_table_name :dummies
85
+ include Property
86
+ end.new
87
+ end
88
+
89
+ should 'be able to include a role with _name_ property' do
90
+ role_with_name = Property::Role.new('foo')
91
+ role_with_name.property do |p|
92
+ p.string :name
93
+ end
94
+
95
+ assert_nothing_raised do
96
+ subject.has_role role_with_name
97
+ end
98
+ end
99
+ end # An instance
80
100
 
81
101
  context 'Property declaration' do
82
102
  Superhero = Class.new(ActiveRecord::Base) do
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 1.1.0
9
+ version: 1.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Renaud Kern
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-22 00:00:00 +02:00
18
+ date: 2010-09-26 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency