demeter 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/demeter.gemspec +2 -2
- data/lib/demeter.rb +2 -2
- data/lib/demeter/version.rb +1 -1
- data/spec/demeter/active_record_spec.rb +6 -0
- data/spec/demeter/demeter_spec.rb +7 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.1
|
data/demeter.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{demeter}
|
8
|
-
s.version = "2.0.
|
8
|
+
s.version = "2.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Emerson Macedo"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-13}
|
13
13
|
s.description = %q{A simple way to apply the Law of Demeter to your Ruby objects.}
|
14
14
|
s.email = %q{emerleite@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/demeter.rb
CHANGED
@@ -32,7 +32,7 @@ module Demeter
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def demeter_names
|
35
|
-
@@demeter_names
|
35
|
+
@@demeter_names ||= []
|
36
36
|
end
|
37
37
|
|
38
38
|
def demeter_names=(names)
|
@@ -42,4 +42,4 @@ module Demeter
|
|
42
42
|
end
|
43
43
|
|
44
44
|
# ActiveRecord support
|
45
|
-
require "demeter/active_record"
|
45
|
+
require "demeter/active_record"
|
data/lib/demeter/version.rb
CHANGED
@@ -11,4 +11,10 @@ describe "Demeter on ActiveRecord" do
|
|
11
11
|
task = Task.create!(:name => "Do the right thing", :project_attributes => {:name => "Amazing Project"})
|
12
12
|
Task.find_by_name("Do the right thing").should == task
|
13
13
|
end
|
14
|
+
|
15
|
+
it "should also dispatch original method missing when not demetered" do
|
16
|
+
Demeter::ClassMethods.send(:remove_class_variable, :@@demeter_names)
|
17
|
+
owner = Owner.new
|
18
|
+
owner.name.should be_nil #name uses ActiveRecord method_missing instance method
|
19
|
+
end
|
14
20
|
end
|
@@ -65,4 +65,11 @@ describe "Demeter" do
|
|
65
65
|
|
66
66
|
doing { subject.address_title }.should raise_error(NoMethodError)
|
67
67
|
end
|
68
|
+
|
69
|
+
describe Demeter::ClassMethods do
|
70
|
+
it "should return an array of demeter_names" do
|
71
|
+
Demeter::ClassMethods.send(:remove_class_variable, :@@demeter_names)
|
72
|
+
User.demeter_names.should be_kind_of(Array)
|
73
|
+
end
|
74
|
+
end
|
68
75
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: demeter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emerson Macedo
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-13 00:00:00 -02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|