Permalink
Browse files

Make Resource.default_repository_name private

* Outside code should use Repository.default_name instead
  • Loading branch information...
1 parent 2ba7b08 commit 989297bbda49f8dd57d0e72b6066e66586ddc8c4 Dan Kubb committed Apr 20, 2008
Showing with 5 additions and 14 deletions.
  1. +5 −5 lib/data_mapper/resource.rb
  2. +0 −9 spec/unit/resource_spec.rb
@@ -192,7 +192,7 @@ def initialize_with_attributes(details) # :nodoc:
end
def validate_resource # :nodoc:
- if self.class.properties(self.class.default_repository_name).empty?
+ if self.class.properties.empty?
raise IncompleteResourceError, 'Resources must have at least one property to be initialized.'
end
end
@@ -227,10 +227,6 @@ def self.extended(base)
base.instance_variable_set(:@properties, Hash.new { |h,k| h[k] = k == :default ? PropertySet.new : h[:default].dup })
end
- def default_repository_name
- Repository.default_name
- end
-
def repository(*args, &block)
DataMapper.repository(*args, &block)
end
@@ -317,6 +313,10 @@ def copy(source, destination, options = {})
private
+ def default_repository_name
+ Repository.default_name
+ end
+
def method_missing(method, *args, &block)
if relationship = relationships[method]
return DataMapper::Query::Path.new([ relationship ],method)
@@ -159,15 +159,6 @@ class Moon
Planet.should respond_to(:after)
end
- it 'should provide default_repository_name' do
- Planet.should respond_to(:default_repository_name)
- end
-
- it '.default_repository_name should delegate to DataMapper::Repository.default_name' do
- DataMapper::Repository.should_receive(:default_name).with(no_args).once.and_return(:default)
- Planet.default_repository_name.should == :default
- end
-
it 'should provide a repository' do
Planet.should respond_to(:repository)
end

0 comments on commit 989297b

Please sign in to comment.