specstar-models 0.2.8 → 0.2.9

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: f41a1f7f12720a9d0b82d36c428fdd9c93623aad
4
- data.tar.gz: 3416740fccb336e41dddf9700184890f4f66c071
3
+ metadata.gz: 0ecb4a4e5725085fc2189a9ae104e721c281c7d7
4
+ data.tar.gz: 036857076591e0b6fda5434f152e7821a890342a
5
5
  SHA512:
6
- metadata.gz: df2b6def7ebf9ec579b50b21499a1f42a4914414baf4c3237ef0d575be6e2b8404e70e4f39f7d36c1dc81ef873650d0080e8185764b5a895d267b535eebd85bd
7
- data.tar.gz: 8375a1dd8e0e6c59cbeca540f9710c81267ca09f366cda63628315dc8b1c14c00a4c22c727d6cbe4b45245763e8e1808293b1f2093d59a62316ae0465f48ec21
6
+ metadata.gz: 1bddfa50bc7d0ef05e325904eb01c64187f47d0297d1e7c6a8c3f6737b1f84125d7691b075d4f4e625a5037f4cf108a286580e14addf4886498c3f93bef6c2c3
7
+ data.tar.gz: 2e4f77b556da6d2ce4fbd9893bf3f76ffd33bd7a8c7c4fd522091703b31f069efb382803247da7d0354258e9902532ab33b61f965dc8dec286885ba2626e74c7
@@ -41,6 +41,21 @@ module Specstar
41
41
  end
42
42
  end
43
43
 
44
+ RSpec::Matchers.define :have_one do |attr, options={}|
45
+ match do |model|
46
+ association = model.class.reflect_on_association(attr)
47
+ association && association.macro == :has_one && match?(association, options)
48
+ end
49
+
50
+ failure_message do |model|
51
+ if options.present?
52
+ "expected #{model.class} to have one #{attr} with #{options}."
53
+ else
54
+ "expected #{model.class} to have one #{attr}."
55
+ end
56
+ end
57
+ end
58
+
44
59
  RSpec::Matchers.define :have_and_belong_to_many do |attr, options={}|
45
60
  match do |model|
46
61
  association = model.class.reflect_on_association(attr)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specstar-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sujoy Gupta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-18 00:00:00.000000000 Z
11
+ date: 2015-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core