dm-core 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +18 -0
- data/Manifest.txt +2 -0
- data/Rakefile +2 -2
- data/dm-core.gemspec +41 -0
- data/lib/dm-core.rb +2 -2
- data/lib/dm-core/adapters/data_objects_adapter.rb +12 -10
- data/lib/dm-core/adapters/mysql_adapter.rb +1 -1
- data/lib/dm-core/adapters/postgres_adapter.rb +1 -1
- data/lib/dm-core/adapters/sqlite3_adapter.rb +1 -1
- data/lib/dm-core/auto_migrations.rb +4 -12
- data/lib/dm-core/model.rb +1 -1
- data/lib/dm-core/query.rb +2 -1
- data/lib/dm-core/version.rb +1 -1
- data/spec/integration/auto_migrations_spec.rb +16 -1
- data/spec/unit/associations/many_to_one_spec.rb +2 -2
- data/spec/unit/model_spec.rb +12 -14
- data/spec/unit/query_spec.rb +11 -5
- data/spec/unit/transaction_spec.rb +13 -13
- metadata +11 -9
data/.gitignore
ADDED
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
|
@@ -13,8 +13,8 @@ AUTHOR = "Sam Smoot"
|
|
|
13
13
|
EMAIL = "ssmoot@gmail.com"
|
|
14
14
|
GEM_NAME = "dm-core"
|
|
15
15
|
GEM_VERSION = DataMapper::VERSION
|
|
16
|
-
GEM_DEPENDENCIES = ["data_objects", "
|
|
17
|
-
["rspec", ">=1.1.3"], ["addressable", "
|
|
16
|
+
GEM_DEPENDENCIES = ["data_objects", "~>0.9.7"], ["extlib", "~>0.9.8"],
|
|
17
|
+
["rspec", ">=1.1.3"], ["addressable", "~>2.0"]
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
PROJECT_NAME = "datamapper"
|
data/dm-core.gemspec
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = %q{dm-core}
|
|
3
|
+
s.version = "0.9.7"
|
|
4
|
+
|
|
5
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
6
|
+
s.authors = ["Sam Smoot"]
|
|
7
|
+
s.date = %q{2008-07-24}
|
|
8
|
+
s.description = %q{Faster, Better, Simpler!}
|
|
9
|
+
s.email = ["ssmoot@gmail.com"]
|
|
10
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
|
11
|
+
s.files = [".autotest", "CONTRIBUTING", "FAQ", "History.txt", "MIT-LICENSE", "Manifest.txt", "QUICKLINKS", "README.txt", "Rakefile", "SPECS", "TODO", "lib/dm-core.rb", "lib/dm-core/adapters.rb", "lib/dm-core/adapters/abstract_adapter.rb", "lib/dm-core/adapters/data_objects_adapter.rb", "lib/dm-core/adapters/mysql_adapter.rb", "lib/dm-core/adapters/postgres_adapter.rb", "lib/dm-core/adapters/sqlite3_adapter.rb", "lib/dm-core/associations.rb", "lib/dm-core/associations/many_to_many.rb", "lib/dm-core/associations/many_to_one.rb", "lib/dm-core/associations/one_to_many.rb", "lib/dm-core/associations/one_to_one.rb", "lib/dm-core/associations/relationship.rb", "lib/dm-core/associations/relationship_chain.rb", "lib/dm-core/auto_migrations.rb", "lib/dm-core/collection.rb", "lib/dm-core/dependency_queue.rb", "lib/dm-core/hook.rb", "lib/dm-core/identity_map.rb", "lib/dm-core/is.rb", "lib/dm-core/logger.rb", "lib/dm-core/migrations/destructive_migrations.rb", "lib/dm-core/migrator.rb", "lib/dm-core/model.rb", "lib/dm-core/naming_conventions.rb", "lib/dm-core/property.rb", "lib/dm-core/property_set.rb", "lib/dm-core/query.rb", "lib/dm-core/repository.rb", "lib/dm-core/resource.rb", "lib/dm-core/scope.rb", "lib/dm-core/support.rb", "lib/dm-core/support/array.rb", "lib/dm-core/support/assertions.rb", "lib/dm-core/support/errors.rb", "lib/dm-core/support/kernel.rb", "lib/dm-core/support/symbol.rb", "lib/dm-core/transaction.rb", "lib/dm-core/type.rb", "lib/dm-core/type_map.rb", "lib/dm-core/types.rb", "lib/dm-core/types/boolean.rb", "lib/dm-core/types/discriminator.rb", "lib/dm-core/types/object.rb", "lib/dm-core/types/paranoid_boolean.rb", "lib/dm-core/types/paranoid_datetime.rb", "lib/dm-core/types/serial.rb", "lib/dm-core/types/text.rb", "lib/dm-core/version.rb", "script/all", "script/performance.rb", "script/profile.rb", "spec/integration/association_spec.rb", "spec/integration/association_through_spec.rb", "spec/integration/associations/many_to_many_spec.rb", "spec/integration/associations/many_to_one_spec.rb", "spec/integration/associations/one_to_many_spec.rb", "spec/integration/auto_migrations_spec.rb", "spec/integration/collection_spec.rb", "spec/integration/data_objects_adapter_spec.rb", "spec/integration/dependency_queue_spec.rb", "spec/integration/model_spec.rb", "spec/integration/mysql_adapter_spec.rb", "spec/integration/postgres_adapter_spec.rb", "spec/integration/property_spec.rb", "spec/integration/query_spec.rb", "spec/integration/repository_spec.rb", "spec/integration/resource_spec.rb", "spec/integration/sqlite3_adapter_spec.rb", "spec/integration/sti_spec.rb", "spec/integration/strategic_eager_loading_spec.rb", "spec/integration/transaction_spec.rb", "spec/integration/type_spec.rb", "spec/lib/logging_helper.rb", "spec/lib/mock_adapter.rb", "spec/lib/model_loader.rb", "spec/lib/publicize_methods.rb", "spec/models/vehicles.rb", "spec/models/zoo.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/unit/adapters/abstract_adapter_spec.rb", "spec/unit/adapters/adapter_shared_spec.rb", "spec/unit/adapters/data_objects_adapter_spec.rb", "spec/unit/adapters/postgres_adapter_spec.rb", "spec/unit/associations/many_to_many_spec.rb", "spec/unit/associations/many_to_one_spec.rb", "spec/unit/associations/one_to_many_spec.rb", "spec/unit/associations/one_to_one_spec.rb", "spec/unit/associations/relationship_spec.rb", "spec/unit/associations_spec.rb", "spec/unit/auto_migrations_spec.rb", "spec/unit/collection_spec.rb", "spec/unit/data_mapper_spec.rb", "spec/unit/identity_map_spec.rb", "spec/unit/is_spec.rb", "spec/unit/migrator_spec.rb", "spec/unit/model_spec.rb", "spec/unit/naming_conventions_spec.rb", "spec/unit/property_set_spec.rb", "spec/unit/property_spec.rb", "spec/unit/query_spec.rb", "spec/unit/repository_spec.rb", "spec/unit/resource_spec.rb", "spec/unit/scope_spec.rb", "spec/unit/transaction_spec.rb", "spec/unit/type_map_spec.rb", "spec/unit/type_spec.rb", "tasks/ci.rb", "tasks/dm.rb", "tasks/doc.rb", "tasks/gemspec.rb", "tasks/hoe.rb", "tasks/install.rb"]
|
|
12
|
+
s.has_rdoc = true
|
|
13
|
+
s.homepage = %q{http://datamapper.org}
|
|
14
|
+
s.rdoc_options = ["--main", "README.txt"]
|
|
15
|
+
s.require_paths = ["lib"]
|
|
16
|
+
s.rubyforge_project = %q{datamapper}
|
|
17
|
+
s.rubygems_version = %q{1.2.0}
|
|
18
|
+
s.summary = %q{An Object/Relational Mapper for Ruby}
|
|
19
|
+
|
|
20
|
+
if s.respond_to? :specification_version then
|
|
21
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
22
|
+
s.specification_version = 2
|
|
23
|
+
|
|
24
|
+
if current_version >= 3 then
|
|
25
|
+
s.add_runtime_dependency(%q<data_objects>, ["~> 0.9.7"])
|
|
26
|
+
s.add_runtime_dependency(%q<extlib>, ["~> 0.9.8"])
|
|
27
|
+
s.add_runtime_dependency(%q<rspec>, [">= 1.1.3"])
|
|
28
|
+
s.add_runtime_dependency(%q<addressable>, ["~> 2.0"])
|
|
29
|
+
else
|
|
30
|
+
s.add_dependency(%q<data_objects>, ["~> 0.9.7"])
|
|
31
|
+
s.add_dependency(%q<extlib>, ["~> 0.9.8"])
|
|
32
|
+
s.add_dependency(%q<rspec>, [">= 1.1.3"])
|
|
33
|
+
s.add_dependency(%q<addressable>, ["~> 2.0"])
|
|
34
|
+
end
|
|
35
|
+
else
|
|
36
|
+
s.add_dependency(%q<data_objects>, ["~> 0.9.7"])
|
|
37
|
+
s.add_dependency(%q<extlib>, ["~> 0.9.8"])
|
|
38
|
+
s.add_dependency(%q<rspec>, [">= 1.1.3"])
|
|
39
|
+
s.add_dependency(%q<addressable>, ["~> 2.0"])
|
|
40
|
+
end
|
|
41
|
+
end
|
data/lib/dm-core.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
gem 'data_objects', '
|
|
1
|
+
gem 'data_objects', '~>0.9.7'
|
|
2
2
|
require 'data_objects'
|
|
3
3
|
|
|
4
4
|
module DataMapper
|
|
@@ -125,16 +125,18 @@ module DataMapper
|
|
|
125
125
|
return uri_or_options
|
|
126
126
|
end
|
|
127
127
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
password = uri_or_options.delete(:password)
|
|
131
|
-
host = uri_or_options.delete(:host)
|
|
132
|
-
port = uri_or_options.delete(:port)
|
|
133
|
-
database = uri_or_options.delete(:database)
|
|
134
|
-
query = uri_or_options.to_a.map { |pair| pair * '=' } * '&'
|
|
135
|
-
query = nil if query == ''
|
|
128
|
+
query = uri_or_options.except(:adapter, :username, :password, :host, :port, :database).map { |pair| pair.join('=') }.join('&')
|
|
129
|
+
query = nil if query.blank?
|
|
136
130
|
|
|
137
|
-
return DataObjects::URI.parse(Addressable::URI.new(
|
|
131
|
+
return DataObjects::URI.parse(Addressable::URI.new(
|
|
132
|
+
:scheme => uri_or_options[:adapter].to_s,
|
|
133
|
+
:user => uri_or_options[:username],
|
|
134
|
+
:password => uri_or_options[:password],
|
|
135
|
+
:host => uri_or_options[:host],
|
|
136
|
+
:port => uri_or_options[:port],
|
|
137
|
+
:path => uri_or_options[:database],
|
|
138
|
+
:query => query
|
|
139
|
+
))
|
|
138
140
|
end
|
|
139
141
|
|
|
140
142
|
# TODO: clean up once transaction related methods move to dm-more/dm-transactions
|
|
@@ -73,12 +73,8 @@ module DataMapper
|
|
|
73
73
|
# @api private
|
|
74
74
|
def auto_migrate_down!(repository_name = self.repository_name)
|
|
75
75
|
# repository_name ||= default_repository_name
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
else
|
|
79
|
-
repository(repository_name) do |r|
|
|
80
|
-
r.adapter.destroy_model_storage(r, self)
|
|
81
|
-
end
|
|
76
|
+
repository(repository_name) do |r|
|
|
77
|
+
r.adapter.destroy_model_storage(r, self.base_model)
|
|
82
78
|
end
|
|
83
79
|
end
|
|
84
80
|
|
|
@@ -88,12 +84,8 @@ module DataMapper
|
|
|
88
84
|
# @param Symbol repository_name the repository to be migrated
|
|
89
85
|
# @api private
|
|
90
86
|
def auto_migrate_up!(repository_name = self.repository_name)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
else
|
|
94
|
-
repository(repository_name) do |r|
|
|
95
|
-
r.adapter.create_model_storage(r, self)
|
|
96
|
-
end
|
|
87
|
+
repository(repository_name) do |r|
|
|
88
|
+
r.adapter.create_model_storage(r, self.base_model)
|
|
97
89
|
end
|
|
98
90
|
end
|
|
99
91
|
|
data/lib/dm-core/model.rb
CHANGED
|
@@ -362,7 +362,7 @@ module DataMapper
|
|
|
362
362
|
|
|
363
363
|
# TODO: spec this
|
|
364
364
|
def to_query(repository, key, query = {})
|
|
365
|
-
conditions = Hash[ *self.key(
|
|
365
|
+
conditions = Hash[ *self.key(repository.name).zip(key).flatten ]
|
|
366
366
|
Query.new(repository, self, query.merge(conditions))
|
|
367
367
|
end
|
|
368
368
|
|
data/lib/dm-core/query.rb
CHANGED
|
@@ -51,10 +51,11 @@ module DataMapper
|
|
|
51
51
|
@limit = other.limit unless other.limit == nil
|
|
52
52
|
@order = other.order unless other.order == model.default_order
|
|
53
53
|
@add_reversed = other.add_reversed? unless other.add_reversed? == false
|
|
54
|
-
@fields = other.fields unless other.fields == @properties.defaults
|
|
55
54
|
@links = other.links unless other.links == []
|
|
56
55
|
@includes = other.includes unless other.includes == []
|
|
57
56
|
|
|
57
|
+
@fields == @properties.defaults ? @fields = other.fields : @fields |= other.fields
|
|
58
|
+
|
|
58
59
|
update_conditions(other)
|
|
59
60
|
|
|
60
61
|
self
|
data/lib/dm-core/version.rb
CHANGED
|
@@ -39,7 +39,10 @@ class EveryType
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
module Publications
|
|
42
|
-
class
|
|
42
|
+
class StoryCollection
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
class ShortStoryCollection < StoryCollection
|
|
43
46
|
include DataMapper::Resource
|
|
44
47
|
property :serial, Serial
|
|
45
48
|
property :date, Date, :nullable => false, :default => TODAY, :index => :date_date_time
|
|
@@ -153,6 +156,10 @@ if HAS_SQLITE3
|
|
|
153
156
|
end
|
|
154
157
|
end
|
|
155
158
|
|
|
159
|
+
it 'should handle a model which inherits from a regular object' do
|
|
160
|
+
lambda { Publications::ShortStoryCollection.auto_migrate!(:sqlite3) }.should_not raise_error
|
|
161
|
+
end
|
|
162
|
+
|
|
156
163
|
it 'should escape a namespaced model' do
|
|
157
164
|
Publications::ShortStoryCollection.auto_migrate!(:sqlite3).should be_true
|
|
158
165
|
@adapter.query('SELECT "name" FROM "sqlite_master" WHERE type = ?', 'table').should include('publications_short_story_collections')
|
|
@@ -259,6 +266,10 @@ if HAS_MYSQL
|
|
|
259
266
|
end
|
|
260
267
|
end
|
|
261
268
|
|
|
269
|
+
it 'should handle a model which inherits from a regular object' do
|
|
270
|
+
lambda { Publications::ShortStoryCollection.auto_migrate!(:mysql) }.should_not raise_error
|
|
271
|
+
end
|
|
272
|
+
|
|
262
273
|
it 'should escape a namespaced model' do
|
|
263
274
|
Publications::ShortStoryCollection.auto_migrate!(:mysql).should be_true
|
|
264
275
|
@adapter.query('SHOW TABLES').should include('publications_short_story_collections')
|
|
@@ -389,6 +400,10 @@ if HAS_POSTGRES
|
|
|
389
400
|
pending 'TODO'
|
|
390
401
|
end
|
|
391
402
|
|
|
403
|
+
it 'should handle a model which inherits from a regular object' do
|
|
404
|
+
lambda { Publications::ShortStoryCollection.auto_migrate!(:postgres) }.should_not raise_error
|
|
405
|
+
end
|
|
406
|
+
|
|
392
407
|
it 'should escape a namespaced model' do
|
|
393
408
|
Publications::ShortStoryCollection.auto_migrate!(:postgres).should be_true
|
|
394
409
|
@adapter.query('SELECT "tablename" FROM "pg_tables" WHERE "tablename" NOT LIKE ?', 'pg_%').should include('publications_short_story_collections')
|
|
@@ -19,7 +19,7 @@ describe DataMapper::Associations::ManyToOne::Proxy do
|
|
|
19
19
|
|
|
20
20
|
before do
|
|
21
21
|
@child = mock('child', :kind_of? => true)
|
|
22
|
-
@parent = mock('parent')
|
|
22
|
+
@parent = mock('parent', :nil? => false, :new_record? => false)
|
|
23
23
|
@relationship = mock('relationship', :kind_of? => true, :get_parent => @parent, :attach_parent => nil)
|
|
24
24
|
@association = DataMapper::Associations::ManyToOne::Proxy.new(@relationship, @child)
|
|
25
25
|
|
|
@@ -62,7 +62,7 @@ describe DataMapper::Associations::ManyToOne::Proxy do
|
|
|
62
62
|
describe '#save' do
|
|
63
63
|
describe 'when the parent is nil' do
|
|
64
64
|
before do
|
|
65
|
-
@parent.
|
|
65
|
+
@parent.stub!(:nil?).and_return(true)
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
it 'should not save the parent' do
|
data/spec/unit/model_spec.rb
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
|
2
2
|
|
|
3
3
|
describe 'DataMapper::Model' do
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
before do
|
|
5
|
+
Object.send(:remove_const, :ModelSpec) if defined?(ModelSpec)
|
|
6
|
+
module ModelSpec
|
|
7
|
+
class Resource
|
|
8
|
+
include DataMapper::Resource
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
storage_names[:legacy] = 'legacy_resource'
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
property :id, Serial
|
|
13
|
+
property :name, String
|
|
14
|
+
property :type, Discriminator
|
|
15
|
+
end
|
|
13
16
|
end
|
|
14
17
|
end
|
|
15
18
|
|
|
@@ -87,7 +90,7 @@ describe 'DataMapper::Model' do
|
|
|
87
90
|
describe '#storage_names' do
|
|
88
91
|
it 'should return a Hash mapping each repository to a storage location' do
|
|
89
92
|
ModelSpec::Resource.storage_names.should be_kind_of(Hash)
|
|
90
|
-
ModelSpec::Resource.storage_names.should == { :
|
|
93
|
+
ModelSpec::Resource.storage_names.should == { :legacy => 'legacy_resource' }
|
|
91
94
|
end
|
|
92
95
|
end
|
|
93
96
|
|
|
@@ -165,12 +168,7 @@ describe 'DataMapper::Model' do
|
|
|
165
168
|
|
|
166
169
|
describe '#storage_exists?' do
|
|
167
170
|
it 'should return whether or not the storage exists' do
|
|
168
|
-
ModelSpec::Resource.
|
|
169
|
-
repository = mock('repository')
|
|
170
|
-
repository.should_receive(:storage_exists?).with('model_spec_resources').and_return(true)
|
|
171
|
-
repository
|
|
172
|
-
end
|
|
173
|
-
ModelSpec::Resource.storage_exists?.should == true
|
|
171
|
+
ModelSpec::Resource.storage_exists?.should == false
|
|
174
172
|
end
|
|
175
173
|
end
|
|
176
174
|
|
data/spec/unit/query_spec.rb
CHANGED
|
@@ -219,6 +219,17 @@ describe DataMapper::Query do
|
|
|
219
219
|
@query.update(other).should == @query
|
|
220
220
|
end
|
|
221
221
|
|
|
222
|
+
it "should merge #fields if :fields != model.properties.defaults" do
|
|
223
|
+
other = DataMapper::Query.new(@repository, Article, :fields => [ :blog_id ])
|
|
224
|
+
@query.update(other).fields.should == Article.properties.slice(:id, :author, :blog_id)
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
it "should replace #fields if fields == model.properties.defaults" do
|
|
228
|
+
query = DataMapper::Query.new(@repository, Article, :fields => Article.properties.defaults.map { |property| property.name })
|
|
229
|
+
other = DataMapper::Query.new(@repository, Article, :fields => [ :blog_id ])
|
|
230
|
+
query.update(other).fields.should == Article.properties.slice(:blog_id)
|
|
231
|
+
end
|
|
232
|
+
|
|
222
233
|
describe 'should overwrite the attribute' do
|
|
223
234
|
it '#reload? with other reload?' do
|
|
224
235
|
other = DataMapper::Query.new(@repository, Article, :reload => true)
|
|
@@ -303,11 +314,6 @@ describe DataMapper::Query do
|
|
|
303
314
|
end
|
|
304
315
|
end
|
|
305
316
|
|
|
306
|
-
it "#fields with other fields unique values" do
|
|
307
|
-
other = DataMapper::Query.new(@repository, Article, :fields => [ :blog_id ])
|
|
308
|
-
@query.update(other).fields.should == Article.properties.slice(:blog_id)
|
|
309
|
-
end
|
|
310
|
-
|
|
311
317
|
it '#conditions with other conditions when they are unique' do
|
|
312
318
|
# set the initial conditions
|
|
313
319
|
@query.update(:title => 'On DataMapper')
|
|
@@ -240,9 +240,9 @@ describe DataMapper::Transaction do
|
|
|
240
240
|
@transaction_primitive.should_receive(:begin)
|
|
241
241
|
@transaction_primitive.should_receive(:rollback)
|
|
242
242
|
@transaction_primitive.should_receive(:close)
|
|
243
|
-
p = Proc.new do
|
|
244
|
-
@transaction.should_receive(:within).with(&p)
|
|
245
|
-
lambda
|
|
243
|
+
p = Proc.new do end
|
|
244
|
+
@transaction.should_receive(:within).with(&p).and_raise(Exception.new('test exception, never mind me'))
|
|
245
|
+
lambda { @transaction.commit(&p) }.should raise_error(Exception, /test exception, never mind me/)
|
|
246
246
|
end
|
|
247
247
|
end
|
|
248
248
|
end
|
|
@@ -280,8 +280,8 @@ describe DataMapper::Transaction do
|
|
|
280
280
|
describe "#method_missing" do
|
|
281
281
|
before :each do
|
|
282
282
|
@transaction = DataMapper::Transaction.new(@adapter, @repository)
|
|
283
|
-
@adapter.should_receive(:is_a?).any_number_of_times.with(
|
|
284
|
-
@adapter.should_receive(:is_a?).any_number_of_times.with(
|
|
283
|
+
@adapter.should_receive(:is_a?).any_number_of_times.with(any_args).and_return(false)
|
|
284
|
+
@adapter.should_receive(:is_a?).any_number_of_times.with(no_args).and_return(false)
|
|
285
285
|
@adapter.should_receive(:is_a?).any_number_of_times.with(Regexp).and_return(false)
|
|
286
286
|
end
|
|
287
287
|
it "should delegate calls to [a method we have]_if_[state](adapter) to [a method we have](adapter) if state of adapter is [state]" do
|
|
@@ -326,11 +326,11 @@ describe DataMapper::Transaction do
|
|
|
326
326
|
describe "#each_adapter" do
|
|
327
327
|
before :each do
|
|
328
328
|
@transaction = DataMapper::Transaction.new(@adapter, @repository)
|
|
329
|
-
@adapter.should_receive(:is_a?).any_number_of_times.with(
|
|
330
|
-
@adapter.should_receive(:is_a?).any_number_of_times.with(
|
|
329
|
+
@adapter.should_receive(:is_a?).any_number_of_times.with(any_args).and_return(false)
|
|
330
|
+
@adapter.should_receive(:is_a?).any_number_of_times.with(no_args).and_return(false)
|
|
331
331
|
@adapter.should_receive(:is_a?).any_number_of_times.with(Regexp).and_return(false)
|
|
332
|
-
@repository_adapter.should_receive(:is_a?).any_number_of_times.with(
|
|
333
|
-
@repository_adapter.should_receive(:is_a?).any_number_of_times.with(
|
|
332
|
+
@repository_adapter.should_receive(:is_a?).any_number_of_times.with(any_args).and_return(false)
|
|
333
|
+
@repository_adapter.should_receive(:is_a?).any_number_of_times.with(no_args).and_return(false)
|
|
334
334
|
@repository_adapter.should_receive(:is_a?).any_number_of_times.with(Regexp).and_return(false)
|
|
335
335
|
end
|
|
336
336
|
it "should send the first argument to itself once for each adapter" do
|
|
@@ -386,8 +386,8 @@ describe DataMapper::Transaction do
|
|
|
386
386
|
describe "#do_adapter" do
|
|
387
387
|
before :each do
|
|
388
388
|
@transaction = DataMapper::Transaction.new(@adapter, @repository)
|
|
389
|
-
@adapter.should_receive(:is_a?).any_number_of_times.with(
|
|
390
|
-
@adapter.should_receive(:is_a?).any_number_of_times.with(
|
|
389
|
+
@adapter.should_receive(:is_a?).any_number_of_times.with(any_args).and_return(false)
|
|
390
|
+
@adapter.should_receive(:is_a?).any_number_of_times.with(no_args).and_return(false)
|
|
391
391
|
@adapter.should_receive(:is_a?).any_number_of_times.with(Regexp).and_return(false)
|
|
392
392
|
end
|
|
393
393
|
it "should raise if there is no connection for the adapter" do
|
|
@@ -447,8 +447,8 @@ describe DataMapper::Transaction do
|
|
|
447
447
|
@other_adapter = mock("adapter")
|
|
448
448
|
@other_adapter.should_receive(:is_a?).any_number_of_times.with(Array).and_return(false)
|
|
449
449
|
@other_adapter.should_receive(:is_a?).any_number_of_times.with(DataMapper::Adapters::AbstractAdapter).and_return(true)
|
|
450
|
-
@other_adapter.should_receive(:is_a?).any_number_of_times.with(
|
|
451
|
-
@other_adapter.should_receive(:is_a?).any_number_of_times.with(
|
|
450
|
+
@other_adapter.should_receive(:is_a?).any_number_of_times.with(any_args).and_return(false)
|
|
451
|
+
@other_adapter.should_receive(:is_a?).any_number_of_times.with(no_args).and_return(false)
|
|
452
452
|
@other_adapter.should_receive(:is_a?).any_number_of_times.with(Regexp).and_return(false)
|
|
453
453
|
@transaction = DataMapper::Transaction.new(@other_adapter)
|
|
454
454
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dm-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sam Smoot
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2008-
|
|
12
|
+
date: 2008-11-18 00:00:00 -08:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -18,9 +18,9 @@ dependencies:
|
|
|
18
18
|
version_requirement:
|
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
|
20
20
|
requirements:
|
|
21
|
-
- -
|
|
21
|
+
- - ~>
|
|
22
22
|
- !ruby/object:Gem::Version
|
|
23
|
-
version: 0.9.
|
|
23
|
+
version: 0.9.7
|
|
24
24
|
version:
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: extlib
|
|
@@ -28,9 +28,9 @@ dependencies:
|
|
|
28
28
|
version_requirement:
|
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- -
|
|
31
|
+
- - ~>
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.9.
|
|
33
|
+
version: 0.9.8
|
|
34
34
|
version:
|
|
35
35
|
- !ruby/object:Gem::Dependency
|
|
36
36
|
name: rspec
|
|
@@ -48,9 +48,9 @@ dependencies:
|
|
|
48
48
|
version_requirement:
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
|
-
- -
|
|
51
|
+
- - ~>
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version:
|
|
53
|
+
version: "2.0"
|
|
54
54
|
version:
|
|
55
55
|
description: Faster, Better, Simpler.
|
|
56
56
|
email:
|
|
@@ -65,6 +65,7 @@ extra_rdoc_files:
|
|
|
65
65
|
- README.txt
|
|
66
66
|
files:
|
|
67
67
|
- .autotest
|
|
68
|
+
- .gitignore
|
|
68
69
|
- CONTRIBUTING
|
|
69
70
|
- FAQ
|
|
70
71
|
- History.txt
|
|
@@ -75,6 +76,7 @@ files:
|
|
|
75
76
|
- Rakefile
|
|
76
77
|
- SPECS
|
|
77
78
|
- TODO
|
|
79
|
+
- dm-core.gemspec
|
|
78
80
|
- lib/dm-core.rb
|
|
79
81
|
- lib/dm-core/adapters.rb
|
|
80
82
|
- lib/dm-core/adapters/abstract_adapter.rb
|
|
@@ -215,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
215
217
|
requirements: []
|
|
216
218
|
|
|
217
219
|
rubyforge_project: datamapper
|
|
218
|
-
rubygems_version: 1.
|
|
220
|
+
rubygems_version: 1.3.1
|
|
219
221
|
signing_key:
|
|
220
222
|
specification_version: 2
|
|
221
223
|
summary: An Object/Relational Mapper for Ruby
|