ardm-types 1.2.2 → 1.2.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64d3d24b7d203fef1dd08c5c63fb97af6e7ffbdd
4
- data.tar.gz: 2ce41762914595258f160111247c308b1f32fe99
3
+ metadata.gz: f3bf1eab52fe398667a3f2665a8c3f954dc330e3
4
+ data.tar.gz: 3210487984089459beae24f5ec224851e86bdea5
5
5
  SHA512:
6
- metadata.gz: e95ea2e08793070c9def64cb04d5cbaa88cfc84ca42c3cff11a25ee05dd1453e74210b1c30fc39a6f747a5a410e721bb84c610e9a74d0ee54be8f758726e0ab0
7
- data.tar.gz: 58809ba9545ede43fce6982293d049bc1270cb015d796a4a75683870843b34b0ad3880576033b8c1f1165c0749bfe647ba6aebadd4c3df365728b9607026b4aa
6
+ metadata.gz: 7aebe5e21e47ef53179805a70701846ebb553a8ab6ab6cea2f5907229c23a1f55d1c9d0c77e933180c068ac2395768dc6a63618c6f29e0183dbb739d2b29cd87
7
+ data.tar.gz: 3029238bbfa1ce468165fced1e0ea5394d940d4824be163c9013fa3177dabb1f1f13378b4b7684c22df0ce01c0e2ffea6e201ad4803fe144c78cbb19a53f87ce
@@ -7,5 +7,4 @@ rvm:
7
7
  - 2.2.0
8
8
  matrix:
9
9
  allow_failures:
10
- - rvm: 2.1.5
11
10
  - rvm: 2.2.0
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ gemspec
7
7
  SOURCE = ENV.fetch('SOURCE', :git).to_sym
8
8
  REPO_POSTFIX = SOURCE == :path ? '' : '.git'
9
9
  DATAMAPPER = SOURCE == :path ? Pathname(__FILE__).dirname.parent : 'http://github.com/ar-dm'
10
- DM_VERSION = '~> 1.2.0'
10
+ DM_VERSION = '~> 1.2'
11
11
  DO_VERSION = '~> 0.10.6'
12
12
  DM_DO_ADAPTERS = %w[ sqlite postgres mysql oracle sqlserver ]
13
13
  CURRENT_BRANCH = ENV.fetch('GIT_BRANCH', 'master')
@@ -0,0 +1,10 @@
1
+ # ardm-types
2
+
3
+ A fork of [`dm-types`](https://github.com/datamapper/dm-types).
4
+
5
+ ## Install
6
+
7
+ See [ardm-core](https://github.com/ar-dm/ardm-core) for more information.
8
+
9
+ Unless they are specific to this gem, please ask general `ardm-` questions
10
+ and open issues on `ardm-core`.
@@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
14
14
 
15
15
  gem.files = `git ls-files`.split("\n")
16
16
  gem.test_files = `git ls-files -- {spec}/*`.split("\n")
17
- gem.extra_rdoc_files = %w[LICENSE README.rdoc]
17
+ gem.extra_rdoc_files = %w[LICENSE README.md]
18
18
  gem.require_paths = [ "lib" ]
19
19
 
20
20
  gem.add_runtime_dependency 'ardm-core', '~> 1.2'
@@ -148,7 +148,10 @@ module DataMapper
148
148
 
149
149
  # Catch any direct assignment (#set), and any Resource#reload (set!).
150
150
  def set!(resource, value)
151
- hook_value(resource, value) unless value.kind_of? Hooker
151
+ # Do not extend non observed value classes
152
+ if Hooker::MUTATION_METHODS.keys.detect { |klass| value.kind_of?(klass) }
153
+ hook_value(resource, value) unless value.kind_of? Hooker
154
+ end
152
155
  super
153
156
  end
154
157
 
@@ -1,5 +1,5 @@
1
1
  module DataMapper
2
2
  module Types
3
- VERSION = '1.2.2'
3
+ VERSION = '1.2.3'
4
4
  end
5
5
  end
@@ -64,6 +64,24 @@ try_spec do
64
64
  end
65
65
  end
66
66
  end
67
+
68
+ describe 'with inventions as a string' do
69
+ before :all do
70
+ object = "Foo and Bar" #.freeze
71
+ @resource.inventions = object
72
+ end
73
+
74
+ describe 'when dumped and loaded again' do
75
+ before :all do
76
+ @resource.save.should be(true)
77
+ @resource.reload
78
+ end
79
+
80
+ it 'has correct inventions' do
81
+ @resource.inventions.should == 'Foo and Bar'
82
+ end
83
+ end
84
+ end
67
85
  end
68
86
  end
69
87
  end
@@ -0,0 +1,64 @@
1
+ require 'spec_helper'
2
+ require 'dm-types/support/dirty_minder'
3
+
4
+ describe DataMapper::Property::DirtyMinder,'set!' do
5
+
6
+ let(:property_class) do
7
+ Class.new(DataMapper::Property::Object) do
8
+ include DataMapper::Property::DirtyMinder
9
+ end
10
+ end
11
+
12
+ let(:model) do
13
+ property_class = self.property_class
14
+ Class.new do
15
+ include DataMapper::Resource
16
+ property :id,DataMapper::Property::Serial
17
+ property :name,property_class
18
+
19
+ def self.name; 'FredsClass'; end
20
+ end
21
+ end
22
+
23
+ let(:resource) { model.new }
24
+
25
+ let(:object) { model.properties[:name] }
26
+
27
+ subject { object.set!(resource,value) }
28
+
29
+ shared_examples_for 'a non hooked value' do
30
+ it 'should not extend value with hook' do
31
+ value.should_not be_kind_of(DataMapper::Property::DirtyMinder::Hooker)
32
+ end
33
+ end
34
+
35
+ shared_examples_for 'a hooked value' do
36
+ it 'should extend value with hook' do
37
+ value.should be_kind_of(DataMapper::Property::DirtyMinder::Hooker)
38
+ end
39
+ end
40
+
41
+ before do
42
+ subject
43
+ end
44
+
45
+ context 'when setting nil' do
46
+ let(:value) { nil }
47
+ it_should_behave_like 'a non hooked value'
48
+ end
49
+
50
+ context 'when setting a String' do
51
+ let(:value) { "The fred" }
52
+ it_should_behave_like 'a non hooked value'
53
+ end
54
+
55
+ context 'when setting an Array' do
56
+ let(:value) { ["The fred"] }
57
+ it_should_behave_like 'a hooked value'
58
+ end
59
+
60
+ context 'when setting a Hash' do
61
+ let(:value) { {"The" => "fred"} }
62
+ it_should_behave_like 'a hooked value'
63
+ end
64
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ardm-types
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Emde
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-29 00:00:00.000000000 Z
12
+ date: 2015-06-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ardm-core
@@ -131,13 +131,13 @@ executables: []
131
131
  extensions: []
132
132
  extra_rdoc_files:
133
133
  - LICENSE
134
- - README.rdoc
134
+ - README.md
135
135
  files:
136
136
  - ".gitignore"
137
137
  - ".travis.yml"
138
138
  - Gemfile
139
139
  - LICENSE
140
- - README.rdoc
140
+ - README.md
141
141
  - Rakefile
142
142
  - ardm-types.gemspec
143
143
  - lib/ardm-types.rb
@@ -193,6 +193,7 @@ files:
193
193
  - spec/spec_helper.rb
194
194
  - spec/unit/bcrypt_hash_spec.rb
195
195
  - spec/unit/csv_spec.rb
196
+ - spec/unit/dirty_minder_spec.rb
196
197
  - spec/unit/enum_spec.rb
197
198
  - spec/unit/epoch_time_spec.rb
198
199
  - spec/unit/file_path_spec.rb
@@ -228,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
229
  version: '0'
229
230
  requirements: []
230
231
  rubyforge_project:
231
- rubygems_version: 2.2.2
232
+ rubygems_version: 2.4.5
232
233
  signing_key:
233
234
  specification_version: 4
234
235
  summary: Ardm fork of dm-types
@@ -1,3 +0,0 @@
1
- = dm-types
2
-
3
- DataMapper plugin providing many extra types for use in data models.