rom-rails 0.4.0 → 0.5.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3eb6dc7cbe13616ba42eb04dedbf46d454e5fee6
4
- data.tar.gz: 3de6f1246346eda7234baec3ada3af5ee425603a
3
+ metadata.gz: e97b52065b6d47076303cb3e7b01bf0b2b26b2d2
4
+ data.tar.gz: 3a20e700c19316431532ea0780e176597e964a04
5
5
  SHA512:
6
- metadata.gz: 7f4f2a71ecc81887fee3c3fd326119af378d3a633dcadcab03191b7410756bbcf39db3ba65d5e1b78e498469299c0de1511b340cd0af861a99ae76a8b3085b64
7
- data.tar.gz: 89106263fa73c8346e2eb7b0062e1c7386c7995e0a9630ae490b40adf5f6e7fde3e6f943b1b1c07d36154469f9f8bf94d0b4004f5dd6e5b8f0e26487a2ab16b6
6
+ metadata.gz: cf5e13ef79c24653c6fb3a83b93de8a01c11a3f9883b7f2dfb1cf0a6030a95bced0b82432d62c174bc05c48f1ef416fce6a50653d80005fee31e2a7c335741d7
7
+ data.tar.gz: 2b939dbc62be89dbaee3e7e9ccafcaa8f93e036b61ad3d9820024d374a8e8fb4e0a75b958c9eef37f93ffc6309daf5cb63c1e341e92bcc4f13866c2830a95a26
data/README.md CHANGED
@@ -23,6 +23,13 @@ ships with:
23
23
  * Mapper generators
24
24
  * Command generators
25
25
 
26
+ ## Tests
27
+
28
+ To run tests:
29
+
30
+ RAILS_ENV=test bundle exec rake db:migrate
31
+ bundle exec rake
32
+
26
33
  ## Issues
27
34
 
28
35
  Please report any issues in the main [rom-rb/rom](https://github.com/rom-rb/rom/issues) issue tracker.
@@ -43,7 +43,11 @@ module ROM
43
43
  #
44
44
  # @api private
45
45
  def relation
46
- rom.relations[relation_name]
46
+ if relation_name
47
+ rom.relations[relation_name]
48
+ else
49
+ raise "relation must be specified to use uniqueness validation"
50
+ end
47
51
  end
48
52
 
49
53
  # Relation name defined on the validator class
@@ -17,6 +17,7 @@ module ROM
17
17
  # Make `ROM::Rails::Configuration` instance available to the user via
18
18
  # `Rails.application.config` before other initializers run.
19
19
  config.before_initialize do |_app|
20
+ ROM.use :auto_registration
20
21
  config.rom = Configuration.new
21
22
  end
22
23
 
@@ -1,5 +1,5 @@
1
1
  module ROM
2
2
  module Rails
3
- VERSION = '0.4.0'.freeze
3
+ VERSION = '0.5.0.beta1'.freeze
4
4
  end
5
5
  end
data/rom-rails.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_runtime_dependency 'rom', '~> 0.8', '>= 0.8.0'
20
+ spec.add_runtime_dependency 'rom', '~> 0.9.0.beta1'
21
21
  spec.add_runtime_dependency 'addressable', '~> 2.3'
22
22
  spec.add_runtime_dependency 'charlatan', '~> 0.1'
23
23
  spec.add_runtime_dependency 'virtus', '~> 1.0', '>= 1.0.5'
@@ -122,6 +122,27 @@ describe 'Validation' do
122
122
  expect(validator).to be_valid
123
123
  end
124
124
  end
125
+
126
+ describe 'with missing relation' do
127
+ let(:user_validator) do
128
+ Class.new {
129
+ include ROM::Model::Validator
130
+
131
+ validates :email, uniqueness: true
132
+
133
+ def self.name
134
+ 'User'
135
+ end
136
+ }
137
+ end
138
+
139
+ it 'raises a helpful error' do
140
+ validator = user_validator.new(user_attrs.new)
141
+ expect {
142
+ validator.valid?
143
+ }.to raise_error(/relation must be specified/)
144
+ end
145
+ end
125
146
  end
126
147
 
127
148
  describe '#method_missing' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rom-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-22 00:00:00.000000000 Z
11
+ date: 2015-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rom
@@ -16,20 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.8'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 0.8.0
19
+ version: 0.9.0.beta1
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '0.8'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 0.8.0
26
+ version: 0.9.0.beta1
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: addressable
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -276,9 +270,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
276
270
  version: '0'
277
271
  required_rubygems_version: !ruby/object:Gem::Requirement
278
272
  requirements:
279
- - - ">="
273
+ - - ">"
280
274
  - !ruby/object:Gem::Version
281
- version: '0'
275
+ version: 1.3.1
282
276
  requirements: []
283
277
  rubyforge_project:
284
278
  rubygems_version: 2.4.5